Small info box handling in cleanup in ncurses

This commit is contained in:
Maxime Coste 2015-09-07 23:15:21 +01:00
parent 3b4bb8674c
commit 53b65401f8

View File

@ -825,13 +825,11 @@ void NCursesUI::info_show(StringView title, StringView content,
{ {
info_hide(); info_hide();
StringView info_box = content; String info_box;
String fancy_info_box;
if (style == InfoStyle::Prompt) if (style == InfoStyle::Prompt)
{ {
fancy_info_box = make_info_box(title, content, m_dimensions.column, info_box = make_info_box(title, content, m_dimensions.column,
m_assistant); m_assistant);
info_box = fancy_info_box;
anchor = CharCoord{m_status_on_top ? 0 : m_dimensions.line, anchor = CharCoord{m_status_on_top ? 0 : m_dimensions.line,
m_dimensions.column-1}; m_dimensions.column-1};
} }
@ -843,9 +841,12 @@ void NCursesUI::info_show(StringView title, StringView content,
if (style == InfoStyle::MenuDoc and m_menu_win) if (style == InfoStyle::MenuDoc and m_menu_win)
col = window_pos(m_menu_win).column + window_size(m_menu_win).column; col = window_pos(m_menu_win).column + window_size(m_menu_win).column;
for (auto& line : wrap_lines(content, m_dimensions.column - col)) const CharCount max_width = m_dimensions.column - col;
fancy_info_box += line + "\n"; if (max_width < 4)
info_box = fancy_info_box; return;
for (auto& line : wrap_lines(content, max_width))
info_box += line + "\n";
} }
CharCoord size = compute_needed_size(info_box); CharCoord size = compute_needed_size(info_box);