aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-23 16:32:15 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-08-23 18:24:14 +0800
commit0ba27bb51d3297aec43e78050cc3adcf6879db22 (patch)
tree9ea8990c9bebeca06d5a5e3989f0a70239797610 /src
parent99265d099c2c366eea936438734a323d1fb9b341 (diff)
downloadrneovim-0ba27bb51d3297aec43e78050cc3adcf6879db22.tar.gz
rneovim-0ba27bb51d3297aec43e78050cc3adcf6879db22.tar.bz2
rneovim-0ba27bb51d3297aec43e78050cc3adcf6879db22.zip
vim-patch:9.0.1710: scrolloff options work slightly different
Problem: sidescrolloff and scrolloff options work slightly different than other global-local options Solution: Make it behave consistent for all global-local options It was noticed, that sidescrolloff and scrolloff options behave differently in comparison to other global-local window options like 'listchars' So make those two behave like other global-local options. Also add some extra documentation for a few special local-window options. Add a few tests to make sure all global-local window options behave similar closes: vim/vim#12956 closes: vim/vim#12643 https://github.com/vim/vim/commit/4a8eb6e7a9df10f79bf95301ced012f0d6a13088 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer_defs.h6
-rw-r--r--src/nvim/option.c2
-rw-r--r--src/nvim/window.c4
3 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index 0a7c742798..c94dbfa7fb 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -230,6 +230,10 @@ typedef struct {
#define w_p_crb_save w_onebuf_opt.wo_crb_save
char *wo_scl;
#define w_p_scl w_onebuf_opt.wo_scl // 'signcolumn'
+ long wo_siso;
+#define w_p_siso w_onebuf_opt.wo_siso // 'sidescrolloff' local value
+ long wo_so;
+#define w_p_so w_onebuf_opt.wo_so // 'scrolloff' local value
char *wo_winhl;
#define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight'
char *wo_lcs;
@@ -1321,8 +1325,6 @@ struct window_S {
uint32_t w_p_fdt_flags; // flags for 'foldtext'
int *w_p_cc_cols; // array of columns to highlight or NULL
uint8_t w_p_culopt_flags; // flags for cursorline highlighting
- long w_p_siso; // 'sidescrolloff' local value
- long w_p_so; // 'scrolloff' local value
int w_briopt_min; // minimum width for breakindent
int w_briopt_shift; // additional shift for breakindent
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 4ca52baa78..56881cbe58 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -4702,6 +4702,8 @@ void copy_winopt(winopt_T *from, winopt_T *to)
to->wo_sms = from->wo_sms;
to->wo_crb = from->wo_crb;
to->wo_crb_save = from->wo_crb_save;
+ to->wo_siso = from->wo_siso;
+ to->wo_so = from->wo_so;
to->wo_spell = from->wo_spell;
to->wo_cuc = from->wo_cuc;
to->wo_cul = from->wo_cul;
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 175a79568c..6ff9e07260 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -5132,8 +5132,8 @@ static win_T *win_alloc(win_T *after, bool hidden)
new_wp->w_ns_hl = -1;
// use global option for global-local options
- new_wp->w_p_so = -1;
- new_wp->w_p_siso = -1;
+ new_wp->w_allbuf_opt.wo_so = new_wp->w_p_so = -1;
+ new_wp->w_allbuf_opt.wo_siso = new_wp->w_p_siso = -1;
// We won't calculate w_fraction until resizing the window
new_wp->w_fraction = 0;