summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 06d4108)
raw | patch | inline | side by side (parent: 06d4108)
author | Jonas Fonseca <fonseca@diku.dk> | |
Sat, 7 Feb 2009 15:25:54 +0000 (16:25 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Sat, 7 Feb 2009 20:23:55 +0000 (21:23 +0100) |
tig.c | patch | blob | history |
index 8a55aab9288ab2c3ea861c619649324937f27a9e..398db4d47a1c89754dc8363f0895c7c09ab0ac59 100644 (file)
--- a/tig.c
+++ b/tig.c
return FALSE;
}
- if (view->p_lineno >= view->lines) {
+ if (view->p_lineno >= view->lines)
view->p_lineno = view->lines > 0 ? view->lines - 1 : 0;
- if (view->p_offset >= view->p_lineno) {
- unsigned long half = view->height / 2;
- if (view->p_lineno > half)
- view->p_offset = view->p_lineno - half;
- else
- view->p_offset = 0;
- }
+ if (view->p_offset > view->p_lineno ||
+ view->p_offset + view->height <= view->p_lineno) {
+ unsigned long half = view->height / 2;
+
+ if (view->p_lineno > half)
+ view->p_offset = view->p_lineno - half;
+ else
+ view->p_offset = 0;
}
if (view_is_displayed(view) &&