diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-09-07 23:15:21 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-09-07 23:15:21 +0100 |
| commit | 53b65401f8c4f03265b7d97240600b121dcc2aef (patch) | |
| tree | 3acfe2c9d03eb82cbc38a5cab6c904117d79f0e8 /src | |
| parent | 3b4bb8674c371e7c1519101398fca0ed96cd75e6 (diff) | |
Small info box handling in cleanup in ncurses
Diffstat (limited to 'src')
| -rw-r--r-- | src/ncurses_ui.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index 19f5a3fd..0a5f807b 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -825,13 +825,11 @@ void NCursesUI::info_show(StringView title, StringView content, { info_hide(); - StringView info_box = content; - String fancy_info_box; + String info_box; if (style == InfoStyle::Prompt) { - fancy_info_box = make_info_box(title, content, m_dimensions.column, - m_assistant); - info_box = fancy_info_box; + info_box = make_info_box(title, content, m_dimensions.column, + m_assistant); anchor = CharCoord{m_status_on_top ? 0 : m_dimensions.line, m_dimensions.column-1}; } @@ -843,9 +841,12 @@ void NCursesUI::info_show(StringView title, StringView content, if (style == InfoStyle::MenuDoc and m_menu_win) col = window_pos(m_menu_win).column + window_size(m_menu_win).column; - for (auto& line : wrap_lines(content, m_dimensions.column - col)) - fancy_info_box += line + "\n"; - info_box = fancy_info_box; + const CharCount max_width = m_dimensions.column - col; + if (max_width < 4) + return; + + for (auto& line : wrap_lines(content, max_width)) + info_box += line + "\n"; } CharCoord size = compute_needed_size(info_box); |
