Try to restore menu after a resize

This commit is contained in:
Maxime Coste 2015-10-13 13:52:02 +01:00
parent f3bce27a08
commit 9f78f9bfd5
2 changed files with 10 additions and 0 deletions

View File

@ -437,6 +437,12 @@ void NCursesUI::check_resize(bool force)
if (char* csr = tigetstr((char*)"csr"))
putp(tparm(csr, (long)0, (long)ws.ws_row));
if (not m_items.empty())
{
auto items = std::move(m_items);
menu_show(items, m_menu_anchor, m_menu_fg, m_menu_bg, m_menu_style);
}
}
else
kak_assert(false);
@ -618,6 +624,8 @@ void NCursesUI::menu_show(ConstArrayView<DisplayLine> items,
m_menu_fg = fg;
m_menu_bg = bg;
m_menu_style = style;
m_menu_anchor = anchor;
if (style == MenuStyle::Prompt)
anchor = CharCoord{m_status_on_top ? 0_line : m_dimensions.line, 0};

View File

@ -91,6 +91,8 @@ private:
Vector<DisplayLine> m_items;
Face m_menu_fg;
Face m_menu_bg;
CharCoord m_menu_anchor;
MenuStyle m_menu_style;
int m_selected_item = 0;
int m_menu_columns = 1;
LineCount m_menu_top_line = 0;