Use wclrtoeol instead of werase
[tig] / tig.c
diff --git a/tig.c b/tig.c
index 7511353..1f92114 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -451,6 +451,9 @@ parse_options(int argc, char *argv[])
        for (i = 1; i < argc; i++) {
                char *opt = argv[i];
 
+               if (opt[0] && opt[0] != '-')
+                       break;
+
                if (!strcmp(opt, "-l")) {
                        opt_request = REQ_VIEW_LOG;
                        continue;
@@ -494,9 +497,6 @@ parse_options(int argc, char *argv[])
                        break;
                }
 
-               if (opt[0] && opt[0] != '-')
-                       break;
-
                die("unknown option '%s'\n\n%s", opt, usage);
        }
 
@@ -1368,8 +1368,8 @@ update_view_title(struct view *view)
        else
                wbkgdset(view->title, get_line_attr(LINE_TITLE_BLUR));
 
-       werase(view->title);
        mvwaddnstr(view->title, 0, 0, buf, bufpos);
+       wclrtoeol(view->title);
        wmove(view->title, 0, view->width - 1);
 
        if (input_mode)
@@ -3132,29 +3132,30 @@ static bool cursed = FALSE;
 /* The status window is used for polling keystrokes. */
 static WINDOW *status_win;
 
+static bool status_empty = TRUE;
+
 /* Update status and title window. */
 static void
 report(const char *msg, ...)
 {
-       static bool empty = TRUE;
        struct view *view = display[current_view];
 
        if (input_mode)
                return;
 
-       if (!empty || *msg) {
+       if (!status_empty || *msg) {
                va_list args;
 
                va_start(args, msg);
 
-               werase(status_win);
                wmove(status_win, 0, 0);
                if (*msg) {
                        vwprintw(status_win, msg, args);
-                       empty = FALSE;
+                       status_empty = FALSE;
                } else {
-                       empty = TRUE;
+                       status_empty = TRUE;
                }
+               wclrtoeol(status_win);
                wrefresh(status_win);
 
                va_end(args);
@@ -3270,6 +3271,7 @@ read_prompt(const char *prompt)
 
        if (status == CANCEL) {
                /* Clear the status window */
+               status_empty = FALSE;
                report("");
                return NULL;
        }