hide ncurses.h include in ncurses.cc
This commit is contained in:
parent
e68f3cfe35
commit
e4d87ee1f1
|
@ -925,7 +925,7 @@ void create_local_client(const String& init_command)
|
|||
|
||||
void signal_handler(int signal)
|
||||
{
|
||||
endwin();
|
||||
NCursesUI::abort();
|
||||
const char* text = nullptr;
|
||||
switch (signal)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <map>
|
||||
|
||||
#include <ncurses.h>
|
||||
#include <signal.h>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
@ -15,6 +16,8 @@
|
|||
namespace Kakoune
|
||||
{
|
||||
|
||||
struct NCursesWin : WINDOW {};
|
||||
|
||||
static void set_attribute(int attribute, bool on)
|
||||
{
|
||||
if (on)
|
||||
|
@ -374,7 +377,7 @@ void NCursesUI::menu_show(const memoryview<String>& choices,
|
|||
|
||||
m_selected_choice = 0;
|
||||
m_menu_top_line = 0;
|
||||
m_menu_win = newwin((int)size.line, (int)size.column,
|
||||
m_menu_win = (NCursesWin*)newwin((int)size.line, (int)size.column,
|
||||
(int)pos.line, (int)pos.column);
|
||||
draw_menu();
|
||||
}
|
||||
|
@ -477,7 +480,7 @@ void NCursesUI::info_show(const String& content, DisplayCoord anchor,
|
|||
|
||||
DisplayCoord pos = compute_pos(anchor, size, m_menu_win);
|
||||
|
||||
m_info_win = newwin((int)size.line, (int)size.column,
|
||||
m_info_win = (NCursesWin*)newwin((int)size.line, (int)size.column,
|
||||
(int)pos.line, (int)pos.column);
|
||||
|
||||
wbkgd(m_info_win, COLOR_PAIR(get_color_pair(colors)));
|
||||
|
@ -507,4 +510,9 @@ void NCursesUI::set_input_callback(InputCallback callback)
|
|||
m_input_callback = std::move(callback);
|
||||
}
|
||||
|
||||
void NCursesUI::abort()
|
||||
{
|
||||
endwin();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
#include "event_manager.hh"
|
||||
#include "user_interface.hh"
|
||||
|
||||
#include <ncurses.h>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
struct NCursesWin;
|
||||
|
||||
class NCursesUI : public UserInterface
|
||||
{
|
||||
public:
|
||||
|
@ -39,6 +39,8 @@ public:
|
|||
void set_input_callback(InputCallback callback) override;
|
||||
|
||||
DisplayCoord dimensions() override;
|
||||
|
||||
static void abort();
|
||||
private:
|
||||
friend void on_term_resize(int);
|
||||
void redraw();
|
||||
|
@ -49,7 +51,7 @@ private:
|
|||
|
||||
DisplayLine m_status_line;
|
||||
|
||||
WINDOW* m_menu_win = nullptr;
|
||||
NCursesWin* m_menu_win = nullptr;
|
||||
std::vector<String> m_choices;
|
||||
ColorPair m_menu_fg;
|
||||
ColorPair m_menu_bg;
|
||||
|
@ -58,7 +60,7 @@ private:
|
|||
LineCount m_menu_top_line = 0;
|
||||
void draw_menu();
|
||||
|
||||
WINDOW* m_info_win = nullptr;
|
||||
NCursesWin* m_info_win = nullptr;
|
||||
|
||||
FDWatcher m_stdin_watcher;
|
||||
InputCallback m_input_callback;
|
||||
|
|
Loading…
Reference in New Issue
Block a user