A simple fix of the bad wrapping bugs
authorJonas Fonseca <fonseca@diku.dk>
Fri, 15 Sep 2006 23:40:10 +0000 (01:40 +0200)
committerJonas Fonseca <fonseca@antimatter.localdomain>
Fri, 15 Sep 2006 23:43:08 +0000 (01:43 +0200)
This was surprisingly simple to fix by just turning off scrolling in
draw_view_line. From the BUGS file:

 - If the screen width is very small the main view can draw 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.

BUGS
tig.c

diff --git a/BUGS b/BUGS
index 79aace6..0783a2e 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -3,10 +3,3 @@ BUGS
 Known bugs and problems:
 
  - In it's current state tig is pretty much UTF-8 only.
-
- - If the screen width is very small the main view can draw
-   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.
diff --git a/tig.c b/tig.c
index 1a5ed4a..b0ce18f 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -1265,6 +1265,7 @@ draw_view_line(struct view *view, unsigned int lineno)
 {
        struct line *line;
        bool selected = (view->offset + lineno == view->lineno);
+       bool draw_ok;
 
        assert(view_is_displayed(view));
 
@@ -1282,7 +1283,11 @@ draw_view_line(struct view *view, unsigned int lineno)
                wclrtoeol(view->win);
        }
 
-       return view->ops->draw(view, line, lineno, selected);
+       scrollok(view->win, FALSE);
+       draw_ok = view->ops->draw(view, line, lineno, selected);
+       scrollok(view->win, TRUE);
+
+       return draw_ok;
 }
 
 static void