Fix some cases where menu items are truncated needlessly

This commit is contained in:
Maxime Coste 2015-11-19 20:23:27 +00:00
parent daf041e839
commit 788c358720

View File

@ -649,10 +649,10 @@ void NCursesUI::menu_show(ConstArrayView<DisplayLine> items,
longest = max(longest, item.length()); longest = max(longest, item.length());
const bool is_prompt = style == MenuStyle::Prompt; 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; 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; maxlen = maxlen / m_menu_columns - 1;
for (auto& item : items) for (auto& item : items)