Make sense of the comment about view->win height
[tig] / tig.c
diff --git a/tig.c b/tig.c
index a0f7911..e57206c 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -715,6 +715,35 @@ redraw_view(struct view *view)
 }
 
 static void
+update_view_title(struct view *view)
+{
+       if (view == display[current_view])
+               wbkgdset(view->title, get_line_attr(LINE_TITLE_FOCUS));
+       else
+               wbkgdset(view->title, get_line_attr(LINE_TITLE_BLUR));
+
+       werase(view->title);
+       wmove(view->title, 0, 0);
+
+       /* [main] ref: 334b506... - commit 6 of 4383 (0%) */
+
+       if (*view->ref)
+               wprintw(view->title, "[%s] %s", view->name, view->ref);
+       else
+               wprintw(view->title, "[%s]", view->name);
+
+       if (view->lines) {
+               wprintw(view->title, " - %s %d of %d (%d%%)",
+                       view->ops->type,
+                       view->lineno + 1,
+                       view->lines,
+                       (view->lineno + 1) * 100 / view->lines);
+       }
+
+       wrefresh(view->title);
+}
+
+static void
 resize_display(void)
 {
        int offset, i;
@@ -744,9 +773,9 @@ resize_display(void)
        offset = 0;
 
        foreach_view (view, i) {
-               /* Keep the size of the all view windows one lager than is
-                * required. This makes current line management easier when the
-                * cursor will go outside the window. */
+               /* 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);
                        if (!view->win)
@@ -770,35 +799,6 @@ resize_display(void)
 }
 
 static void
-update_view_title(struct view *view)
-{
-       if (view == display[current_view])
-               wbkgdset(view->title, get_line_attr(LINE_TITLE_FOCUS));
-       else
-               wbkgdset(view->title, get_line_attr(LINE_TITLE_BLUR));
-
-       werase(view->title);
-       wmove(view->title, 0, 0);
-
-       /* [main] ref: 334b506... - commit 6 of 4383 (0%) */
-
-       if (*view->ref)
-               wprintw(view->title, "[%s] %s", view->name, view->ref);
-       else
-               wprintw(view->title, "[%s]", view->name);
-
-       if (view->lines) {
-               wprintw(view->title, " - %s %d of %d (%d%%)",
-                       view->ops->type,
-                       view->lineno + 1,
-                       view->lines,
-                       (view->lineno + 1) * 100 / view->lines);
-       }
-
-       wrefresh(view->title);
-}
-
-static void
 redraw_display(void)
 {
        struct view *view;