From fc9e0e8c6ae866674f494e366ba548cb02282667 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 26 Nov 2019 22:08:05 +1100 Subject: [PATCH] Fix small info text not being displayed --- src/ncurses_ui.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index 0e1c984f..5ffedc14 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -1052,6 +1052,7 @@ void NCursesUI::info_show(const DisplayLine& title, const DisplayLineList& conte DisplayCoord size{(int)content.size(), accumulate(content, 0_col, [](ColumnCount c, const DisplayLine& l) { return std::max(c, l.length()); })}; + size.column = std::max(size.column, title.length() + (framed ? 2 : 0)); if (framed) size += {2, 4}; if (assisted) @@ -1060,7 +1061,7 @@ void NCursesUI::info_show(const DisplayLine& title, const DisplayLineList& conte size = {std::min(max_size.line, size.line), std::min(max_size.column, size.column)}; const auto content_width = size.column - (framed ? 4 : 2) - (assisted ? m_assistant[0].column_length() : 0); - if (content_width < 4 or (framed and size.line < 3) or size.line <= 0) + if (content_width <= 0 or (framed and size.line < 3) or size.line <= 0) return; const Rect rect = {content_line_offset(), m_dimensions}; @@ -1117,7 +1118,7 @@ void NCursesUI::info_show(const DisplayLine& title, const DisplayLineList& conte draw_atoms(content[(int)line]); else if (line == 0) { - if (title.atoms().empty()) + if (title.atoms().empty() or content_width < 2) draw_atoms("╭─" + String{dash, content_width} + "─╮"); else {