From 39b72c5ace72d960ab50b56d2f1c6d2a3bbf5fca Mon Sep 17 00:00:00 2001 From: "Jonathan Klee (jklee)" Date: Mon, 7 Jul 2014 18:06:12 +0200 Subject: [PATCH] clear to end of line before starting to print line --- ngp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ngp.c b/ngp.c index bb2b644..0615cbd 100644 --- a/ngp.c +++ b/ngp.c @@ -223,6 +223,10 @@ static void print_line(int *y, char *line) strncpy(cropped_line, line, crop); + /* first clear line */ + move(*y, 0); + clrtoeol(); + /* display line number */ pos = strtok_r(cropped_line, ":", &buf); attron(COLOR_PAIR(2)); @@ -265,6 +269,10 @@ static void print_file(int *y, char *line) char cropped_line[PATH_MAX] = ""; int crop = COLS; + /* first clear line */ + move(*y, 0); + clrtoeol(); + strncpy(cropped_line, line, crop); attron(COLOR_PAIR(5)); mvprintw(*y, 0, "%s", cropped_line,