diff options
-rw-r--r-- | src/option.c | 37 | ||||
-rw-r--r-- | src/testdir/test89.in | 37 | ||||
-rw-r--r-- | src/testdir/test89.ok | 15 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 78 insertions, 13 deletions
diff --git a/src/option.c b/src/option.c index f9d9fd5c2..467d578a6 100644 --- a/src/option.c +++ b/src/option.c @@ -7631,22 +7631,33 @@ set_bool_option(opt_idx, varp, value, opt_flags) } #endif - /* 'number', 'relativenumber' */ - else if ((int *)varp == &curwin->w_p_nu - || (int *)varp == &curwin->w_p_rnu) + /* If 'number' is set, reset 'relativenumber'. */ + /* If 'relativenumber' is set, reset 'number'. */ + else if ((int *)varp == &curwin->w_p_nu && curwin->w_p_nu) { - /* If 'number' is set, reset 'relativenumber'. */ - /* If 'relativenumber' is set, reset 'number'. */ - if ((int *)varp == &curwin->w_p_nu && curwin->w_p_nu) - { - curwin->w_p_rnu = FALSE; + curwin->w_p_rnu = FALSE; + + /* Only reset the global value if the own value is set globally. */ + if (((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)) curwin->w_allbuf_opt.wo_rnu = FALSE; - } - if ((int *)varp == &curwin->w_p_rnu && curwin->w_p_rnu) - { - curwin->w_p_nu = FALSE; + } + else if ((int *)varp == &curwin->w_p_rnu && curwin->w_p_rnu) + { + curwin->w_p_nu = FALSE; + + /* Only reset the global value if the own value is set globally. */ + if (((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)) curwin->w_allbuf_opt.wo_nu = FALSE; - } + } + else if ((int *)varp == &curwin->w_allbuf_opt.wo_nu + && curwin->w_allbuf_opt.wo_nu) + { + curwin->w_allbuf_opt.wo_rnu = FALSE; + } + else if ((int *)varp == &curwin->w_allbuf_opt.wo_rnu + && curwin->w_allbuf_opt.wo_rnu) + { + curwin->w_allbuf_opt.wo_nu = FALSE; } else if ((int *)varp == &curbuf->b_p_ro) diff --git a/src/testdir/test89.in b/src/testdir/test89.in index 7b25b20c1..122165d4f 100644 --- a/src/testdir/test89.in +++ b/src/testdir/test89.in @@ -10,6 +10,43 @@ STARTTEST :$put ='results:' :$put a :$put b +:" +:set nonu nornu +:setglobal nu +:setlocal rnu +:redir @c | setglobal nu? | redir END +:set nonu nornu +:setglobal rnu +:setlocal nu +:redir @d | setglobal rnu? | redir END +:$put =':setlocal must NOT reset the other global value' +:$put c +:$put d +:" +:set nonu nornu +:setglobal nu +:setglobal rnu +:redir @e | setglobal nu? | redir END +:set nonu nornu +:setglobal rnu +:setglobal nu +:redir @f | setglobal rnu? | redir END +:$put =':setglobal MUST reset the other global value' +:$put e +:$put f +:" +:set nonu nornu +:set nu +:set rnu +:redir @g | setglobal nu? | redir END +:set nonu nornu +:set rnu +:set nu +:redir @h | setglobal rnu? | redir END +:$put =':set MUST reset the other global value' +:$put g +:$put h +:" :/^results/,$w! test.out :q! ENDTEST diff --git a/src/testdir/test89.ok b/src/testdir/test89.ok index 0f45471dc..93824bb94 100644 --- a/src/testdir/test89.ok +++ b/src/testdir/test89.ok @@ -5,3 +5,18 @@ nonumber nonumber relativenumber +:setlocal must NOT reset the other global value + + number + + relativenumber +:setglobal MUST reset the other global value + +nonumber + +norelativenumber +:set MUST reset the other global value + +nonumber + +norelativenumber diff --git a/src/version.c b/src/version.c index 237ec19dc..cf24d39aa 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 861, +/**/ 860, /**/ 859, |