ui/ncurses: Clear remaining space when drawing help line

Message ID 20180112051114.22519-1-sam@mendozajonas.com
State New
Headers show
Series
  • ui/ncurses: Clear remaining space when drawing help line
Related show

Commit Message

Samuel Mendoza-Jonas Jan. 12, 2018, 5:11 a.m.
When drawing the screen's help line clear each character after the new
help line to avoid stale parts of the previous screen's help line
remaining on the screen.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
 ui/ncurses/nc-scr.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch

diff --git a/ui/ncurses/nc-scr.c b/ui/ncurses/nc-scr.c
index a02627b..0200d01 100644
--- a/ui/ncurses/nc-scr.c
+++ b/ui/ncurses/nc-scr.c
@@ -77,6 +77,10 @@  void nc_scr_frame_draw(struct nc_scr *scr)
 
 	mvwhline(scr->main_ncw, LINES - nc_scr_pos_help_sep, 1, ACS_HLINE,
 		COLS - 2);
+	if (1 + strlen(scr->frame.help) < COLS)
+		mvwhline(scr->main_ncw, LINES - nc_scr_pos_help,
+				1 + strlen(scr->frame.help), ' ',
+				COLS - 1 - strlen(scr->frame.help));
 	mvwaddstr(scr->main_ncw, LINES - nc_scr_pos_help, 1, scr->frame.help);
 	nc_scr_status_draw(scr);
 }