commit c3e9aa982c53be0d0445b0f6a3b6d7e8c69d54b9 from: joshua stein date: Mon May 13 21:22:45 2019 UTC tog: at eof in diff view, print (END) like less does commit - d83d9d5c431189537fc94c38a85ce2b8e3217f5d commit + c3e9aa982c53be0d0445b0f6a3b6d7e8c69d54b9 blob - 353d457f02b70f88f644afb414f0c36306d4e00c blob + f4576eab2bb36a37be6488852d70c1e26bc4d3cd --- tog/tog.c +++ tog/tog.c @@ -99,6 +99,8 @@ enum tog_view_type { TOG_VIEW_BLAME, TOG_VIEW_TREE }; + +#define TOG_EOF_STRING "(END)" struct commit_queue_entry { TAILQ_ENTRY(commit_queue_entry) entry; @@ -1958,7 +1960,7 @@ parse_next_line(FILE *f, size_t *len) static const struct got_error * draw_file(struct tog_view *view, FILE *f, int *first_displayed_line, int *last_displayed_line, int *eof, int max_lines, - char * header) + char *header) { const struct got_error *err; int nlines = 0, nprinted = 0; @@ -2018,7 +2020,23 @@ draw_file(struct tog_view *view, FILE *f, int *first_d *last_displayed_line = nlines; view_vborder(view); + + if (*eof) { + while (nprinted < view->nlines) { + waddch(view->window, '\n'); + nprinted++; + } + + err = format_line(&wline, &width, TOG_EOF_STRING, view->ncols); + if (err) { + return err; + } + wstandout(view->window); + waddwstr(view->window, wline); + wstandend(view->window); + } + return NULL; }