From d3c3e59bbf1e8407b5238d309f69032c3476c227 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 17 Nov 2019 22:53:27 +1100 Subject: [PATCH] Fix search menu trimmed entry display --- src/ncurses_ui.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index 2e92f7c0..683fa84a 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -802,13 +802,18 @@ void NCursesUI::draw_menu() const ColumnCount item_width = item.length(); auto& face = i == m_menu.selected_item ? m_menu.fg : m_menu.bg; m_menu.draw(m_palette, item.atoms(), face); - m_menu.draw(m_palette, DisplayAtom(item_width > win_width - pos ? "…" : " "), - m_menu.bg); + if (pos + item_width < win_width) + m_menu.draw(m_palette, DisplayAtom(" "), m_menu.bg); + else + { + m_menu.move_cursor({0, win_width+2}); + m_menu.draw(m_palette, DisplayAtom("…"), m_menu.bg); + } pos += item_width + 1; } - auto end_str = String{' ', pos > win_width ? 0 : win_width - pos + 1} + (i == item_count ? " " : ">"); - m_menu.draw(m_palette, DisplayAtom(end_str), m_menu.bg); + m_menu.move_cursor({0, win_width+3}); + m_menu.draw(m_palette, DisplayAtom(i == item_count ? " " : ">"), m_menu.bg); m_dirty = true; return;