From 04ecb2cc5ae9cd860d6a1e697e362e9d1f34049d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 20 Nov 2014 13:56:37 +0000 Subject: [PATCH] Wrap info boxes text in ncurses display even in Inline menu style --- src/ncurses.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ncurses.cc b/src/ncurses.cc index 1a93d04d..45e032bf 100644 --- a/src/ncurses.cc +++ b/src/ncurses.cc @@ -762,14 +762,24 @@ void NCursesUI::info_show(StringView title, StringView content, anchor = CharCoord{m_status_on_top ? 0 : m_dimensions.line, m_dimensions.column-1}; } - else if (m_status_on_top) - anchor.line += 1; + else + { + if (m_status_on_top) + anchor.line += 1; + CharCount col = anchor.column; + 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; + } CharCoord size = compute_needed_size(info_box); CharCoord pos; - if (style == InfoStyle::MenuDoc and m_menu_win and m_menu_columns == 1) + if (style == InfoStyle::MenuDoc and m_menu_win) pos = window_pos(m_menu_win) + - CharCoord{0_line, window_size(m_menu_win).column}; + CharCoord{0_line, window_size(m_menu_win).column}; else pos = compute_pos(anchor, size, m_menu_win, style == InfoStyle::InlineAbove);