aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/move.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/move.c')
-rw-r--r--src/nvim/move.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c
index 3978539df6..97fd472850 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -213,8 +213,8 @@ static void reset_skipcol(win_T *wp)
void update_topline(win_T *wp)
{
bool check_botline = false;
- long *so_ptr = wp->w_p_so >= 0 ? &wp->w_p_so : &p_so;
- long save_so = *so_ptr;
+ OptInt *so_ptr = wp->w_p_so >= 0 ? &wp->w_p_so : &p_so;
+ OptInt save_so = *so_ptr;
// Cursor is updated instead when this is true for 'splitkeep'.
if (skip_update_topline) {
@@ -288,7 +288,7 @@ void update_topline(win_T *wp)
if (halfheight < 2) {
halfheight = 2;
}
- long n;
+ int64_t n;
if (hasAnyFolding(wp)) {
// Count the number of logical lines between the cursor and
// topline + p_so (approximation of how much will be
@@ -371,7 +371,7 @@ void update_topline(win_T *wp)
}
}
if (check_botline) {
- long line_count = 0;
+ int line_count = 0;
if (hasAnyFolding(wp)) {
// Count the number of logical lines between the cursor and
// botline - p_so (approximation of how much will be
@@ -386,7 +386,7 @@ void update_topline(win_T *wp)
(void)hasFolding(lnum, &lnum, NULL);
}
} else {
- line_count = wp->w_cursor.lnum - wp->w_botline + 1 + *so_ptr;
+ line_count = wp->w_cursor.lnum - wp->w_botline + 1 + (int)(*so_ptr);
}
if (line_count <= wp->w_height_inner + 1) {
scroll_cursor_bot(scrolljump_value(), false);
@@ -427,9 +427,8 @@ void update_topline(win_T *wp)
// When 'scrolljump' is negative use it as a percentage of the window height.
static int scrolljump_value(void)
{
- long result = p_sj >= 0 ? p_sj : (curwin->w_height_inner * -p_sj) / 100;
- assert(result <= INT_MAX);
- return (int)result;
+ int result = p_sj >= 0 ? (int)p_sj : (curwin->w_height_inner * (int)(-p_sj)) / 100;
+ return result;
}
// Return true when there are not 'scrolloff' lines above the cursor for the