diff options
-rw-r--r-- | src/nvim/edit.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 2 | ||||
-rw-r--r-- | src/nvim/move.c | 20 | ||||
-rw-r--r-- | src/nvim/normal.c | 6 | ||||
-rw-r--r-- | src/nvim/option.c | 8 | ||||
-rw-r--r-- | src/nvim/screen.c | 2 | ||||
-rw-r--r-- | src/nvim/window.c | 2 |
7 files changed, 22 insertions, 20 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 1cf821f786..b0dffc3af2 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -594,7 +594,7 @@ static int insert_check(VimState *state) if (curwin->w_wcol < s->mincol - curbuf->b_p_ts && curwin->w_wrow == curwin->w_winrow - + curwin->w_height_inner - 1 - get_scrolloff_value() + + curwin->w_height_inner - 1 - get_scrolloff_value(curwin) && (curwin->w_cursor.lnum != curwin->w_topline || curwin->w_topfill > 0)) { if (curwin->w_topfill > 0) { diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index a5eccc12b9..bca3823b7f 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -7362,7 +7362,7 @@ static void ex_syncbind(exarg_T *eap) topline = curwin->w_topline; FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { if (wp->w_p_scb && wp->w_buffer) { - y = wp->w_buffer->b_ml.ml_line_count - get_scrolloff_value(); + y = wp->w_buffer->b_ml.ml_line_count - get_scrolloff_value(curwin); if (topline > y) { topline = y; } diff --git a/src/nvim/move.c b/src/nvim/move.c index fdcf6bb189..25618f43b0 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -368,7 +368,7 @@ static int scrolljump_value(void) */ static bool check_top_offset(void) { - long so = get_scrolloff_value(); + long so = get_scrolloff_value(curwin); if (curwin->w_cursor.lnum < curwin->w_topline + so || hasAnyFolding(curwin) ) { @@ -729,8 +729,8 @@ void curs_columns( colnr_T startcol; colnr_T endcol; colnr_T prev_skipcol; - long so = get_scrolloff_value(); - long siso = get_sidescrolloff_value(); + long so = get_scrolloff_value(curwin); + long siso = get_sidescrolloff_value(curwin); /* * First make sure that w_topline is valid (after moving the cursor). @@ -1231,7 +1231,7 @@ void scrolldown_clamp(void) end_row += curwin->w_cline_height - 1 - curwin->w_virtcol / curwin->w_width_inner; } - if (end_row < curwin->w_height_inner - get_scrolloff_value()) { + if (end_row < curwin->w_height_inner - get_scrolloff_value(curwin)) { if (can_fill) { ++curwin->w_topfill; check_topfill(curwin, true); @@ -1271,7 +1271,7 @@ void scrollup_clamp(void) validate_virtcol(); start_row -= curwin->w_virtcol / curwin->w_width_inner; } - if (start_row >= get_scrolloff_value()) { + if (start_row >= get_scrolloff_value(curwin)) { if (curwin->w_topfill > 0) { curwin->w_topfill--; } else { @@ -1374,7 +1374,7 @@ void scroll_cursor_top(int min_scroll, int always) linenr_T old_topline = curwin->w_topline; linenr_T old_topfill = curwin->w_topfill; linenr_T new_topline; - int off = (int)get_scrolloff_value(); + int off = (int)get_scrolloff_value(curwin); if (mouse_dragging > 0) off = mouse_dragging - 1; @@ -1518,7 +1518,7 @@ void scroll_cursor_bot(int min_scroll, int set_topbot) int old_valid = curwin->w_valid; int old_empty_rows = curwin->w_empty_rows; linenr_T cln = curwin->w_cursor.lnum; // Cursor Line Number - long so = get_scrolloff_value(); + long so = get_scrolloff_value(curwin); if (set_topbot) { used = 0; @@ -1751,8 +1751,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(); - int below_wanted = (int)get_scrolloff_value(); + int above_wanted = (int)get_scrolloff_value(curwin); + int below_wanted = (int)get_scrolloff_value(curwin); if (mouse_dragging > 0) { above_wanted = mouse_dragging - 1; below_wanted = mouse_dragging - 1; @@ -1848,7 +1848,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(); + long 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 0293bb4a73..95553ccc52 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2629,7 +2629,7 @@ do_mouse ( /* Set global flag that we are extending the Visual area with mouse * dragging; temporarily minimize 'scrolloff'. */ - if (VIsual_active && is_drag && get_scrolloff_value()) { + if (VIsual_active && is_drag && get_scrolloff_value(curwin)) { // In the very first line, allow scrolling one line if (mouse_row == 0) { mouse_dragging = 2; @@ -4135,7 +4135,7 @@ void scroll_redraw(int up, long count) scrollup(count, true) : scrolldown(count, true); - if (get_scrolloff_value()) { + if (get_scrolloff_value(curwin)) { // Adjust the cursor position for 'scrolloff'. Mark w_topline as // valid, otherwise the screen jumps back at the end of the file. cursor_correct(); @@ -4185,7 +4185,7 @@ static void nv_zet(cmdarg_T *cap) int old_fen = curwin->w_p_fen; bool undo = false; - int l_p_siso = (int)get_sidescrolloff_value(); + int l_p_siso = (int)get_sidescrolloff_value(curwin); assert(l_p_siso <= INT_MAX); if (ascii_isdigit(nchar)) { diff --git a/src/nvim/option.c b/src/nvim/option.c index 7cf8412269..dc2591510c 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -7159,20 +7159,20 @@ dict_T *get_winbuf_options(const int bufopt) /// Return the effective 'scrolloff' value for the current window, using the /// global value when appropriate. -long get_scrolloff_value(void) +long get_scrolloff_value(win_T *wp) { // Disallow scrolloff in terminal-mode. #11915 if (State & TERM_FOCUS) { return 0; } - return curwin->w_p_so < 0 ? p_so : curwin->w_p_so; + return 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(void) +long get_sidescrolloff_value(win_T *wp) { - return curwin->w_p_siso < 0 ? p_siso : curwin->w_p_siso; + return wp->w_p_siso < 0 ? p_siso : wp->w_p_siso; } Dictionary get_vimoption(String name, Error *err) diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 2eeeebb88d..0018a50477 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2820,10 +2820,12 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, n_extra = col + 1; } else { n_extra = grid->Columns - col; + ILOG("n_extra %d vs total widht %d", grid->Columns, col); } char_attr = win_hl_attr(wp, HLF_DED); } if (*p_sbr != NUL && need_showbreak) { + ILOG("need showbreak %d", need_showbreak); /* Draw 'showbreak' at the start of each broken line. */ p_extra = p_sbr; c_extra = NUL; diff --git a/src/nvim/window.c b/src/nvim/window.c index 9eb16e67ec..fe6a94984e 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -5859,7 +5859,7 @@ void scroll_to_fraction(win_T *wp, int prev_height) } if (wp == curwin) { - if (get_scrolloff_value()) { + if (get_scrolloff_value(wp)) { update_topline(); } curs_columns(false); // validate w_wrow |