From b82d31016b455d16dde8cb79a08d42a29aa762e1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 20 Jun 2018 08:12:53 +1000 Subject: [PATCH] Do not draw menu if it would hide prompt content --- src/ncurses_ui.cc | 7 +++++-- src/ncurses_ui.hh | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index fd206bad..113d4dd8 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -324,7 +324,9 @@ void NCursesUI::redraw() pnoutrefresh(m_window, 0, 0, 0, 0, (int)m_dimensions.line + 1, (int)m_dimensions.column); - m_menu.refresh(); + if (m_menu.columns != 0 or m_menu.pos.column > m_status_len) + m_menu.refresh(); + m_info.refresh(); if (m_cursor.mode == CursorMode::Prompt) @@ -432,7 +434,8 @@ void NCursesUI::draw_status(const DisplayLine& status_line, draw_line(m_window, status_line, 0, m_dimensions.column, default_face); const auto mode_len = mode_line.length(); - const auto remaining = m_dimensions.column - status_line.length(); + m_status_len = status_line.length(); + const auto remaining = m_dimensions.column - m_status_len; if (mode_len < remaining) { ColumnCount col = m_dimensions.column - mode_len; diff --git a/src/ncurses_ui.hh b/src/ncurses_ui.hh index acb3558a..69eee61c 100644 --- a/src/ncurses_ui.hh +++ b/src/ncurses_ui.hh @@ -151,6 +151,8 @@ private: bool m_resize_pending = false; void set_resize_pending(); + + ColumnCount m_status_len = 0; }; }