Code

Make the view title show percentage shown like less
authorJonas Fonseca <fonseca@diku.dk>
Sun, 4 Jun 2006 00:46:30 +0000 (02:46 +0200)
committerJonas Fonseca Madsen <fonseca@ask.diku.dk>
Sun, 4 Jun 2006 00:46:30 +0000 (02:46 +0200)
The cursor position is already summoned up as "line x of X".

tig.c

diff --git a/tig.c b/tig.c
index 0f77167fbdfa40f55ac8a34dcc813dc5d686554d..1f36682b28fde0bcc859b07f9741156170704d4e 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -867,8 +867,9 @@ update_view_title(struct view *view)
                wprintw(view->title, "[%s]", view->name);
 
        if (view->lines || view->pipe) {
+               unsigned int view_lines = view->offset + view->height;
                unsigned int lines = view->lines
-                                  ? (view->lineno + 1) * 100 / view->lines
+                                  ? MIN(view_lines, view->lines) * 100 / view->lines
                                   : 0;
 
                wprintw(view->title, " - %s %d of %d (%d%%)",