Improve ncurses redraw behaviour
This commit is contained in:
parent
2162157752
commit
7c22ff217d
|
@ -284,7 +284,6 @@ NCursesUI::~NCursesUI()
|
|||
|
||||
void NCursesUI::redraw()
|
||||
{
|
||||
redrawwin(m_window);
|
||||
wnoutrefresh(m_window);
|
||||
if (m_menu_win)
|
||||
{
|
||||
|
@ -616,9 +615,7 @@ void NCursesUI::menu_show(ConstArrayView<String> items,
|
|||
CharCoord anchor, Face fg, Face bg,
|
||||
MenuStyle style)
|
||||
{
|
||||
if (m_menu_win)
|
||||
delwin(m_menu_win);
|
||||
m_items.clear();
|
||||
menu_hide();
|
||||
|
||||
m_menu_fg = fg;
|
||||
m_menu_bg = bg;
|
||||
|
@ -688,6 +685,7 @@ void NCursesUI::menu_hide()
|
|||
if (not m_menu_win)
|
||||
return;
|
||||
m_items.clear();
|
||||
mark_dirty(m_menu_win);
|
||||
delwin(m_menu_win);
|
||||
m_menu_win = nullptr;
|
||||
m_dirty = true;
|
||||
|
@ -871,11 +869,20 @@ void NCursesUI::info_hide()
|
|||
{
|
||||
if (not m_info_win)
|
||||
return;
|
||||
mark_dirty(m_info_win);
|
||||
delwin(m_info_win);
|
||||
m_info_win = nullptr;
|
||||
m_dirty = true;
|
||||
}
|
||||
|
||||
void NCursesUI::mark_dirty(NCursesWin* region)
|
||||
{
|
||||
auto pos = window_pos(region);
|
||||
auto size = window_size(region);
|
||||
|
||||
wredrawln(m_window, (int)pos.line, (int)size.line);
|
||||
}
|
||||
|
||||
CharCoord NCursesUI::dimensions()
|
||||
{
|
||||
return m_dimensions;
|
||||
|
|
|
@ -57,6 +57,8 @@ private:
|
|||
void draw_line(const DisplayLine& line, CharCount col_index,
|
||||
const Face& default_face) const;
|
||||
|
||||
void mark_dirty(NCursesWin* region);
|
||||
|
||||
NCursesWin* m_window = nullptr;
|
||||
|
||||
CharCoord m_dimensions;
|
||||
|
|
Loading…
Reference in New Issue
Block a user