X-Git-Url: https://git.distorted.org.uk/~mdw/tig/blobdiff_plain/8d27b36ea5e4e2f282d6e080b9bc0c134d29257a..66c86725fdb3e159b2fde146e26c7dadd51e528c:/tig.c diff --git a/tig.c b/tig.c index 18b4488..f5f536c 100644 --- a/tig.c +++ b/tig.c @@ -451,6 +451,14 @@ parse_options(int argc, char *argv[]) for (i = 1; i < argc; i++) { char *opt = argv[i]; + if (!strcmp(opt, "log") || + !strcmp(opt, "diff") || + !strcmp(opt, "show")) { + opt_request = opt[0] == 'l' + ? REQ_VIEW_LOG : REQ_VIEW_DIFF; + break; + } + if (opt[0] && opt[0] != '-') break; @@ -489,14 +497,6 @@ parse_options(int argc, char *argv[]) break; } - if (!strcmp(opt, "log") || - !strcmp(opt, "diff") || - !strcmp(opt, "show")) { - opt_request = opt[0] == 'l' - ? REQ_VIEW_LOG : REQ_VIEW_DIFF; - 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); @@ -3268,11 +3269,12 @@ read_prompt(const char *prompt) } } - if (status == CANCEL) { - /* Clear the status window */ - report(""); + /* Clear the status window */ + status_empty = FALSE; + report(""); + + if (status == CANCEL) return NULL; - } buf[pos++] = 0;