From: Jonas Fonseca Date: Tue, 23 May 2006 22:29:24 +0000 (+0200) Subject: Improve title updating and remove flickering X-Git-Tag: tig-0.4~60 X-Git-Url: https://git.distorted.org.uk/~mdw/tig/commitdiff_plain/c19f8017cc2dd8753f92f9952e65cfad28acbbe0 Improve title updating and remove flickering - Show line info even if no lines has been loaded, so less has to be redrawn. - Don't make the view window one line bigger causing the title window to be overwritten. This reinstates the bug in last line drawing. --- diff --git a/tig.c b/tig.c index 05fb370..52abe0f 100644 --- a/tig.c +++ b/tig.c @@ -807,12 +807,16 @@ update_view_title(struct view *view) else wprintw(view->title, "[%s]", view->name); - if (view->lines) { + if (view->lines || view->pipe) { + unsigned int lines = view->lines + ? (view->lineno + 1) * 100 / view->lines + : 0; + wprintw(view->title, " - %s %d of %d (%d%%)", view->ops->type, view->lineno + 1, view->lines, - (view->lineno + 1) * 100 / view->lines); + lines); } if (view->pipe) { @@ -857,11 +861,8 @@ resize_display(void) offset = 0; foreach_view (view, i) { - /* Keep the height of all view->win windows one larger than is - * required so that the cursor can wrap-around on the last line - * without scrolling the window. */ if (!view->win) { - view->win = newwin(view->height + 1, 0, offset, 0); + view->win = newwin(view->height, 0, offset, 0); if (!view->win) die("Failed to create %s view", view->name); @@ -872,7 +873,7 @@ resize_display(void) die("Failed to create title window"); } else { - wresize(view->win, view->height + 1, view->width); + wresize(view->win, view->height, view->width); mvwin(view->win, offset, 0); mvwin(view->title, offset + view->height, 0); wrefresh(view->win); @@ -2583,6 +2584,9 @@ main(int argc, char *argv[]) * outside the current view causing bad wrapping. Same goes * for title and status windows. * + * - The cursor can wrap-around on the last line and cause the + * window to scroll. + * * TODO * ---- * Features that should be explored.