aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/cursor.c2
-rw-r--r--src/nvim/ex_docmd.c2
-rw-r--r--src/nvim/move.c32
-rw-r--r--src/nvim/normal.c2
-rw-r--r--src/nvim/option.c8
-rw-r--r--src/nvim/window.c2
6 files changed, 23 insertions, 25 deletions
diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c
index 8ba0b2ffb3..a837618f5b 100644
--- a/src/nvim/cursor.c
+++ b/src/nvim/cursor.c
@@ -460,7 +460,7 @@ bool set_leftcol(colnr_T leftcol)
bool retval = false;
// If the cursor is right or left of the screen, move it to last or first
// visible character.
- long siso = get_sidescrolloff_value(curwin);
+ int siso = get_sidescrolloff_value(curwin);
if (curwin->w_virtcol > (colnr_T)(lastcol - siso)) {
retval = true;
coladvance((colnr_T)(lastcol - siso));
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index f154b5b77f..c170029bdc 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -5716,7 +5716,7 @@ static void ex_sleep(exarg_T *eap)
setcursor_mayforce(true);
}
- linenr_T len = eap->line2;
+ int64_t len = eap->line2;
switch (*eap->arg) {
case 'm':
break;
diff --git a/src/nvim/move.c b/src/nvim/move.c
index a68f6a2d50..6b49f6d6e1 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -443,7 +443,7 @@ static int scrolljump_value(void)
// current window.
static bool check_top_offset(void)
{
- long so = get_scrolloff_value(curwin);
+ int so = get_scrolloff_value(curwin);
if (curwin->w_cursor.lnum < curwin->w_topline + so
|| hasAnyFolding(curwin)) {
lineoff_T loff;
@@ -899,11 +899,9 @@ void curs_columns(win_T *wp, int may_scroll)
// If Cursor is right of the screen, scroll leftwards
// If we get closer to the edge than 'sidescrolloff', scroll a little
// extra
- long siso = get_sidescrolloff_value(wp);
- assert(siso <= INT_MAX);
- int off_left = startcol - wp->w_leftcol - (int)siso;
- int off_right =
- endcol - wp->w_leftcol - wp->w_width_inner + (int)siso + 1;
+ int siso = get_sidescrolloff_value(wp);
+ int off_left = startcol - wp->w_leftcol - siso;
+ int off_right = endcol - wp->w_leftcol - wp->w_width_inner + siso + 1;
if (off_left < 0 || off_right > 0) {
int diff = (off_left < 0) ? -off_left : off_right;
@@ -949,7 +947,7 @@ void curs_columns(win_T *wp, int may_scroll)
}
int plines = 0;
- long so = get_scrolloff_value(wp);
+ int so = get_scrolloff_value(wp);
colnr_T prev_skipcol = wp->w_skipcol;
if ((wp->w_wrow >= wp->w_height_inner
|| ((prev_skipcol > 0
@@ -978,7 +976,7 @@ void curs_columns(win_T *wp, int may_scroll)
plines--;
if (plines > wp->w_wrow + so) {
assert(so <= INT_MAX);
- n = wp->w_wrow + (int)so;
+ n = wp->w_wrow + so;
} else {
n = plines;
}
@@ -1002,7 +1000,7 @@ void curs_columns(win_T *wp, int may_scroll)
} else if (extra == 1) {
// less than 'scrolloff' lines above, decrease skipcol
assert(so <= INT_MAX);
- extra = (wp->w_skipcol + (int)so * width2 - wp->w_virtcol + width2 - 1) / width2;
+ extra = (wp->w_skipcol + so * width2 - wp->w_virtcol + width2 - 1) / width2;
if (extra > 0) {
if ((colnr_T)(extra * width2) > wp->w_skipcol) {
extra = wp->w_skipcol / width2;
@@ -1324,7 +1322,7 @@ bool scrolldown(long line_count, int byfold)
}
if (curwin->w_cursor.lnum == curwin->w_topline && do_sms) {
- long so = get_scrolloff_value(curwin);
+ int so = get_scrolloff_value(curwin);
long scrolloff_cols = so == 0 ? 0 : width1 + (so - 1) * width2;
// make sure the cursor is in the visible text
@@ -1452,7 +1450,7 @@ bool scrollup(linenr_T line_count, int byfold)
int width1 = curwin->w_width_inner - col_off;
int width2 = width1 + col_off2;
int extra2 = col_off - col_off2;
- long so = get_scrolloff_value(curwin);
+ int so = get_scrolloff_value(curwin);
long scrolloff_cols = so == 0 ? 0 : width1 + (so - 1) * width2;
int space_cols = (curwin->w_height_inner - 1) * width2;
@@ -1503,7 +1501,7 @@ void adjust_skipcol(void)
return; // no text will be displayed
}
int width2 = width1 + curwin_col_off2();
- long so = get_scrolloff_value(curwin);
+ int so = get_scrolloff_value(curwin);
long scrolloff_cols = so == 0 ? 0 : width1 + (so - 1) * width2;
bool scrolled = false;
@@ -1753,7 +1751,7 @@ void scroll_cursor_top(int min_scroll, int always)
linenr_T old_topline = curwin->w_topline;
int old_skipcol = curwin->w_skipcol;
linenr_T old_topfill = curwin->w_topfill;
- int off = (int)get_scrolloff_value(curwin);
+ int off = get_scrolloff_value(curwin);
if (mouse_dragging > 0) {
off = mouse_dragging - 1;
@@ -2003,7 +2001,7 @@ void scroll_cursor_bot(int min_scroll, int set_topbot)
int fill_below_window = win_get_fill(curwin, curwin->w_botline) - curwin->w_filler_rows;
int extra = 0;
- long so = get_scrolloff_value(curwin);
+ int so = get_scrolloff_value(curwin);
while (loff.lnum > 1) {
// Stop when scrolled nothing or at least "min_scroll", found "extra"
// context for 'scrolloff' and counted all lines below the window.
@@ -2245,8 +2243,8 @@ void cursor_correct(void)
{
// How many lines we would like to have above/below the cursor depends on
// whether the first/last line of the file is on screen.
- int above_wanted = (int)get_scrolloff_value(curwin);
- int below_wanted = (int)get_scrolloff_value(curwin);
+ int above_wanted = get_scrolloff_value(curwin);
+ int below_wanted = get_scrolloff_value(curwin);
if (mouse_dragging > 0) {
above_wanted = mouse_dragging - 1;
below_wanted = mouse_dragging - 1;
@@ -2349,7 +2347,7 @@ int onepage(Direction dir, long count)
int retval = OK;
lineoff_T loff;
linenr_T old_topline = curwin->w_topline;
- long so = get_scrolloff_value(curwin);
+ int so = get_scrolloff_value(curwin);
if (curbuf->b_ml.ml_line_count == 1) { // nothing to do
beep_flush();
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index edfc62ae17..f9689d7593 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2812,7 +2812,7 @@ static void nv_zet(cmdarg_T *cap)
long old_fdl = curwin->w_p_fdl;
int old_fen = curwin->w_p_fen;
- int siso = (int)get_sidescrolloff_value(curwin);
+ int siso = get_sidescrolloff_value(curwin);
if (ascii_isdigit(nchar) && !nv_z_get_count(cap, &nchar)) {
return;
diff --git a/src/nvim/option.c b/src/nvim/option.c
index bece6f3605..4ca52baa78 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -6117,20 +6117,20 @@ dict_T *get_winbuf_options(const int bufopt)
/// Return the effective 'scrolloff' value for the current window, using the
/// global value when appropriate.
-linenr_T get_scrolloff_value(win_T *wp)
+int get_scrolloff_value(win_T *wp)
{
// Disallow scrolloff in terminal-mode. #11915
if (State & MODE_TERMINAL) {
return 0;
}
- return wp->w_p_so < 0 ? (linenr_T)p_so : (linenr_T)wp->w_p_so;
+ return (int)(wp->w_p_so < 0 ? p_so : wp->w_p_so);
}
/// Return the effective 'sidescrolloff' value for the current window, using the
/// global value when appropriate.
-long get_sidescrolloff_value(win_T *wp)
+int get_sidescrolloff_value(win_T *wp)
{
- return wp->w_p_siso < 0 ? p_siso : wp->w_p_siso;
+ return (int)(wp->w_p_siso < 0 ? p_siso : wp->w_p_siso);
}
Dictionary get_vimoption(String name, int scope, buf_T *buf, win_T *win, Error *err)
diff --git a/src/nvim/window.c b/src/nvim/window.c
index c475169261..0ad30b4417 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -6516,7 +6516,7 @@ static void win_fix_cursor(int normal)
}
// Determine valid cursor range.
- linenr_T so = MIN(wp->w_height_inner / 2, get_scrolloff_value(wp));
+ int so = MIN(wp->w_height_inner / 2, get_scrolloff_value(wp));
linenr_T lnum = wp->w_cursor.lnum;
wp->w_cursor.lnum = wp->w_topline;