Skip to content

Commit

Permalink
updated for version 7.3.861
Browse files Browse the repository at this point in the history
Problem:    ":setlocal number" clears global value of 'relativenumber'.
Solution:   Do it properly. (Markus Heidelberg)
  • Loading branch information
brammool committed Mar 13, 2013
1 parent 81d54b3 commit 1670720
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 13 deletions.
37 changes: 24 additions & 13 deletions src/option.c
Expand Up @@ -7631,22 +7631,33 @@ set_bool_option(opt_idx, varp, value, opt_flags)
} }
#endif #endif


/* 'number', 'relativenumber' */ /* If 'number' is set, reset 'relativenumber'. */
else if ((int *)varp == &curwin->w_p_nu /* If 'relativenumber' is set, reset 'number'. */
|| (int *)varp == &curwin->w_p_rnu) else if ((int *)varp == &curwin->w_p_nu && curwin->w_p_nu)
{ {
/* If 'number' is set, reset 'relativenumber'. */ curwin->w_p_rnu = FALSE;
/* If 'relativenumber' is set, reset 'number'. */
if ((int *)varp == &curwin->w_p_nu && curwin->w_p_nu) /* Only reset the global value if the own value is set globally. */
{ if (((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0))
curwin->w_p_rnu = FALSE;
curwin->w_allbuf_opt.wo_rnu = FALSE; curwin->w_allbuf_opt.wo_rnu = FALSE;
} }
if ((int *)varp == &curwin->w_p_rnu && curwin->w_p_rnu) else if ((int *)varp == &curwin->w_p_rnu && curwin->w_p_rnu)
{ {
curwin->w_p_nu = FALSE; 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; 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) else if ((int *)varp == &curbuf->b_p_ro)
Expand Down
37 changes: 37 additions & 0 deletions src/testdir/test89.in
Expand Up @@ -10,6 +10,43 @@ STARTTEST
:$put ='results:' :$put ='results:'
:$put a :$put a
:$put b :$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 :/^results/,$w! test.out
:q! :q!
ENDTEST ENDTEST
Expand Down
15 changes: 15 additions & 0 deletions src/testdir/test89.ok
Expand Up @@ -5,3 +5,18 @@ nonumber


nonumber nonumber
relativenumber 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
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -728,6 +728,8 @@ static char *(features[]) =


static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
861,
/**/ /**/
860, 860,
/**/ /**/
Expand Down

0 comments on commit 1670720

Please sign in to comment.