summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8c31721)
raw | patch | inline | side by side (parent: 8c31721)
author | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 11 Sep 2006 22:05:06 +0000 (00:05 +0200) | ||
committer | Jonas Fonseca <fonseca@antimatter.localdomain> | |
Mon, 11 Sep 2006 22:05:06 +0000 (00:05 +0200) |
tig.c | patch | blob | history |
index 25c423c5fd70fb5449407e46745625491cb9be78..72d57cc4dc94fc6d8321ebb6fc6918a71aabba8c 100644 (file)
--- a/tig.c
+++ b/tig.c
/* Cursor moving */
static void
-move_view(struct view *view, enum request request, bool redraw)
+move_view(struct view *view, enum request request)
{
+ bool scroll = FALSE;
int steps;
switch (request) {
view->lineno += steps;
assert(0 <= view->lineno && view->lineno < view->lines);
- /* Repaint the old "current" line if we be scrolling */
- if (ABS(steps) < view->height)
- draw_view_line(view, view->lineno - steps - view->offset);
-
/* Check whether the view needs to be scrolled */
if (view->lineno < view->offset ||
view->lineno >= view->offset + view->height) {
}
}
+ scroll = TRUE;
+ }
+
+ if (!view_is_displayed(view)) {
+ view->offset += steps;
+ view->ops->select(view, &view->line[view->lineno]);
+ return;
+ }
+
+ /* Repaint the old "current" line if we be scrolling */
+ if (ABS(steps) < view->height)
+ draw_view_line(view, view->lineno - steps - view->offset);
+
+ if (scroll) {
do_scroll_view(view, steps);
return;
}
/* Draw the current line */
draw_view_line(view, view->lineno - view->offset);
- if (!redraw)
- return;
-
redrawwin(view->win);
wrefresh(view->win);
report("");
case REQ_MOVE_PAGE_DOWN:
case REQ_MOVE_FIRST_LINE:
case REQ_MOVE_LAST_LINE:
- move_view(view, request, TRUE);
+ move_view(view, request);
break;
case REQ_SCROLL_LINE_DOWN:
view->parent == VIEW(REQ_VIEW_MAIN)) ||
(view == VIEW(REQ_VIEW_BLOB) &&
view->parent == VIEW(REQ_VIEW_TREE))) {
- bool redraw = display[1] == view;
-
view = view->parent;
- move_view(view, request, redraw);
- if (redraw)
+ move_view(view, request);
+ if (view_is_displayed(view))
update_view_title(view);
} else {
- move_view(view, request, TRUE);
+ move_view(view, request);
break;
}
/* Fall-through */