Code

Remove limitation of horizontal scrolling
authorJonas Fonseca <fonseca@diku.dk>
Sun, 15 Feb 2009 16:28:12 +0000 (17:28 +0100)
committerJonas Fonseca <fonseca@diku.dk>
Sun, 15 Feb 2009 17:03:57 +0000 (18:03 +0100)
Tig now behaves similar to less in that the user can scroll without
limit to the right.

tig.c

diff --git a/tig.c b/tig.c
index 1b5f0f22513fd6bfa59a669524d9ef2129162171..9c6cf010121229e65245f038de74e76c529bcaea 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -1771,7 +1771,6 @@ struct view {
        enum line_type curtype; /* Attribute currently used for drawing. */
        unsigned long col;      /* Column when drawing. */
        bool has_scrolled;      /* View was scrolled. */
-       bool can_hscroll;       /* View can be scrolled horizontally. */
 
        /* Loading */
        struct io io;
@@ -1892,9 +1891,6 @@ draw_chars(struct view *view, enum line_type type, const char *string,
                col++;
        }
 
-       if (view->col + col >= view->width + view->yoffset)
-               view->can_hscroll = TRUE;
-
        return col;
 }
 
@@ -2122,9 +2118,6 @@ redraw_view_from(struct view *view, int lineno)
 {
        assert(0 <= lineno && lineno < view->height);
 
-       if (lineno == 0)
-               view->can_hscroll = FALSE;
-
        for (; lineno < view->height; lineno++) {
                if (!draw_view_line(view, lineno))
                        break;
@@ -2387,10 +2380,6 @@ scroll_view(struct view *view, enum request request)
                report("");
                return;
        case REQ_SCROLL_RIGHT:
-               if (!view->can_hscroll) {
-                       report("Cannot scroll beyond the last column");
-                       return;
-               }
                view->yoffset += apply_step(opt_hscroll, view->width);
                if (view->yoffset > view->width)
                        view->yoffset = view->width;