summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c02d8fc)
raw | patch | inline | side by side (parent: c02d8fc)
author | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 11 Sep 2006 21:07:46 +0000 (23:07 +0200) | ||
committer | Jonas Fonseca <fonseca@antimatter.localdomain> | |
Mon, 11 Sep 2006 21:07:46 +0000 (23:07 +0200) |
tig.c | patch | blob | history |
index 2f32941b900d759539a9d59d8cd8659a8219ac6b..7dba19d2f9fe88c4f707ed1702734f425ce6cb55 100644 (file)
--- a/tig.c
+++ b/tig.c
static void
do_scroll_view(struct view *view, int lines, bool redraw)
{
+ bool redraw_current_line = FALSE;
+
assert(view_is_displayed(view));
/* The rendering expects the new offset. */
assert(0 <= view->offset && view->offset < view->lines);
assert(lines);
+ /* Move current line into the view. */
+ if (view->lineno < view->offset) {
+ view->lineno = view->offset;
+ redraw_current_line = TRUE;
+ } else if (view->lineno >= view->offset + view->height) {
+ view->lineno = view->offset + view->height - 1;
+ redraw_current_line = TRUE;
+ }
+
+ assert(view->offset <= view->lineno && view->lineno < view->lines);
+
/* Redraw the whole screen if scrolling is pointless. */
if (view->height < ABS(lines)) {
redraw_view(view);
if (!draw_view_line(view, line))
break;
}
- }
-
- /* Move current line into the view. */
- if (view->lineno < view->offset) {
- view->lineno = view->offset;
- draw_view_line(view, 0);
- } else if (view->lineno >= view->offset + view->height) {
- view->lineno = view->offset + view->height - 1;
- draw_view_line(view, view->lineno - view->offset);
+ if (redraw_current_line)
+ draw_view_line(view, view->lineno - view->offset);
}
- assert(view->offset <= view->lineno && view->lineno < view->lines);
-
if (!redraw)
return;