[PATCH] ui/ncurses: Clear remaining space when drawing help line

Samuel Mendoza-Jonas sam at mendozajonas.com
Fri Jan 12 16:11:14 AEDT 2018


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 at mendozajonas.com>
---
 ui/ncurses/nc-scr.c | 4 ++++
 1 file changed, 4 insertions(+)

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);
 }
-- 
2.15.1



More information about the Petitboot mailing list