From 788c3587205280b008b3e918664436b31a9d7325 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 19 Nov 2015 20:23:27 +0000 Subject: [PATCH] Fix some cases where menu items are truncated needlessly --- src/ncurses_ui.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index e89cdc4d..933c3eb3 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -649,10 +649,10 @@ void NCursesUI::menu_show(ConstArrayView items, longest = max(longest, item.length()); const bool is_prompt = style == MenuStyle::Prompt; - m_menu_columns = is_prompt ? max((int)((maxsize.column - 1) / longest), 1) : 1; + m_menu_columns = is_prompt ? max((int)((maxsize.column-1) / (longest+1)), 1) : 1; CharCount maxlen = maxsize.column-1; - if (m_menu_columns > 1) + if (m_menu_columns > 1 and item_count > 1) maxlen = maxlen / m_menu_columns - 1; for (auto& item : items)