summaryrefslogtreecommitdiffstats
path: root/src/move.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-09-25 22:16:38 +0000
committerBram Moolenaar <Bram@vim.org>2005-09-25 22:16:38 +0000
commit1e01546026ce909b5fe56c05867f28e77d1b6eb3 (patch)
tree05ccef65c430097352670acbbeb5520d649ba841 /src/move.c
parentbfd8fc0529f46612f7b3efca6c7b3305e70ac374 (diff)
updated for version 7.0150
Diffstat (limited to 'src/move.c')
-rw-r--r--src/move.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/move.c b/src/move.c
index ac59320cfe..c8a5a23216 100644
--- a/src/move.c
+++ b/src/move.c
@@ -20,6 +20,7 @@
#include "vim.h"
static void comp_botline __ARGS((win_T *wp));
+static int scrolljump_value __ARGS((void));
static int check_top_offset __ARGS((void));
static void curs_rows __ARGS((win_T *wp, int do_botline));
static void validate_botline_win __ARGS((win_T *wp));
@@ -249,7 +250,7 @@ update_topline()
scroll_cursor_halfway(FALSE);
else
{
- scroll_cursor_top((int)p_sj, FALSE);
+ scroll_cursor_top(scrolljump_value(), FALSE);
check_botline = TRUE;
}
}
@@ -341,7 +342,7 @@ update_topline()
line_count = curwin->w_cursor.lnum - curwin->w_botline
+ 1 + p_so;
if (line_count <= curwin->w_height + 1)
- scroll_cursor_bot((int)p_sj, FALSE);
+ scroll_cursor_bot(scrolljump_value(), FALSE);
else
scroll_cursor_halfway(FALSE);
}
@@ -377,6 +378,19 @@ update_topline()
}
/*
+ * Return the scrolljump value to use for the current window.
+ * When 'scrolljump' is positive use it as-is.
+ * When 'scrolljump' is negative use it as a percentage of the window height.
+ */
+ static int
+scrolljump_value()
+{
+ if (p_sj >= 0)
+ return (int)p_sj;
+ return (curwin->w_height * -p_sj) / 100;
+}
+
+/*
* Return TRUE when there are not 'scrolloff' lines above the cursor for the
* current window.
*/