aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorWill Eccles <will@eccles.dev>2020-03-17 15:05:34 -0400
committerGitHub <noreply@github.com>2020-03-17 20:05:34 +0100
commit87d892afa0475644e91d9c8a57b7c35491c4dc32 (patch)
treea3d0f66e64156fbbb47864a6ed36129bd7c41318 /src/nvim/normal.c
parent5a5c2f0290b5cdb8ccc1a06cb41f248ab25fd792 (diff)
downloadrneovim-87d892afa0475644e91d9c8a57b7c35491c4dc32.tar.gz
rneovim-87d892afa0475644e91d9c8a57b7c35491c4dc32.tar.bz2
rneovim-87d892afa0475644e91d9c8a57b7c35491c4dc32.zip
vim-patch:8.1.0864 Make 'scrolloff' and 'sidescrolloff' options window local (#11854)
Problem: cannot have a local value for 'scrolloff' and 'sidescrolloff' Author: Bram Moolenar https://github.com/vim/vim/commit/375e3390078e740d3c83b0c118c50d9a920036c7
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 6434bd00d8..6c92b136da 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2584,12 +2584,13 @@ do_mouse (
/* Set global flag that we are extending the Visual area with mouse
* dragging; temporarily minimize 'scrolloff'. */
- if (VIsual_active && is_drag && p_so) {
- /* In the very first line, allow scrolling one line */
- if (mouse_row == 0)
+ if (VIsual_active && is_drag && get_scrolloff_value()) {
+ // In the very first line, allow scrolling one line
+ if (mouse_row == 0) {
mouse_dragging = 2;
- else
+ } else {
mouse_dragging = 1;
+ }
}
/* When dragging the mouse above the window, scroll down. */
@@ -4089,9 +4090,9 @@ void scroll_redraw(int up, long count)
scrollup(count, true);
else
scrolldown(count, true);
- if (p_so) {
- /* Adjust the cursor position for 'scrolloff'. Mark w_topline as
- * valid, otherwise the screen jumps back at the end of the file. */
+ if (get_scrolloff_value()) {
+ // Adjust the cursor position for 'scrolloff'. Mark w_topline as
+ // valid, otherwise the screen jumps back at the end of the file.
cursor_correct();
check_cursor_moved(curwin);
curwin->w_valid |= VALID_TOPLINE;
@@ -4135,8 +4136,8 @@ static void nv_zet(cmdarg_T *cap)
int old_fen = curwin->w_p_fen;
bool undo = false;
- assert(p_siso <= INT_MAX);
- int l_p_siso = (int)p_siso;
+ int l_p_siso = (int)get_sidescrolloff_value();
+ assert(l_p_siso <= INT_MAX);
if (ascii_isdigit(nchar)) {
/*