285 lines
8.1 KiB
Plaintext
285 lines
8.1 KiB
Plaintext
|
To: vim_dev@googlegroups.com
|
||
|
Subject: Patch 7.3.1115
|
||
|
Fcc: outbox
|
||
|
From: Bram Moolenaar <Bram@moolenaar.net>
|
||
|
Mime-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
------------
|
||
|
|
||
|
Patch 7.3.1115
|
||
|
Problem: Many users don't like the cursor line number when 'relativenumber'
|
||
|
is set.
|
||
|
Solution: Have four combinations with 'number' and 'relativenumber'.
|
||
|
(Christian Brabandt)
|
||
|
Files: runtime/doc/options.txt, src/option.c, src/screen.c,
|
||
|
src/testdir/test89.in, src/testdir/test89.ok
|
||
|
|
||
|
|
||
|
*** ../vim-7.3.1114/runtime/doc/options.txt 2013-03-19 16:46:59.000000000 +0100
|
||
|
--- runtime/doc/options.txt 2013-06-04 22:01:35.000000000 +0200
|
||
|
***************
|
||
|
*** 5077,5084 ****
|
||
|
number.
|
||
|
When a long, wrapped line doesn't start with the first character, '-'
|
||
|
characters are put before the number.
|
||
|
! See |hl-LineNr| for the highlighting used for the number.
|
||
|
! When setting this option, 'relativenumber' is reset.
|
||
|
|
||
|
*'numberwidth'* *'nuw'*
|
||
|
'numberwidth' 'nuw' number (Vim default: 4 Vi default: 8)
|
||
|
--- 5130,5149 ----
|
||
|
number.
|
||
|
When a long, wrapped line doesn't start with the first character, '-'
|
||
|
characters are put before the number.
|
||
|
! See |hl-LineNr| and |hl-CursorLineNr| for the highlighting used for
|
||
|
! the number.
|
||
|
! *number_relativenumber*
|
||
|
! The 'relativenumber' option changes the displayed number to be
|
||
|
! relative to the cursor. Together with 'number' there are these
|
||
|
! four combinations (cursor in line 3):
|
||
|
!
|
||
|
! 'nonu' 'nu' 'nonu' 'nu'
|
||
|
! 'nornu' 'nornu' 'rnu' 'rnu'
|
||
|
!
|
||
|
! |apple | 1 apple | 2 apple | 2 apple
|
||
|
! |pear | 2 pear | 1 pear | 1 pear
|
||
|
! |nobody | 3 nobody | 0 nobody |3 nobody
|
||
|
! |there | 4 there | 1 there | 1 there
|
||
|
|
||
|
*'numberwidth'* *'nuw'*
|
||
|
'numberwidth' 'nuw' number (Vim default: 4 Vi default: 8)
|
||
|
***************
|
||
|
*** 5484,5491 ****
|
||
|
number.
|
||
|
When a long, wrapped line doesn't start with the first character, '-'
|
||
|
characters are put before the number.
|
||
|
! See |hl-LineNr| for the highlighting used for the number.
|
||
|
! When setting this option, 'number' is reset.
|
||
|
|
||
|
*'remap'* *'noremap'*
|
||
|
'remap' boolean (default on)
|
||
|
--- 5556,5567 ----
|
||
|
number.
|
||
|
When a long, wrapped line doesn't start with the first character, '-'
|
||
|
characters are put before the number.
|
||
|
! See |hl-LineNr| and |hl-CursorLineNr| for the highlighting used for
|
||
|
! the number.
|
||
|
!
|
||
|
! The number in front of the cursor line also depends on the value of
|
||
|
! 'number', see |number_relativenumber| for all combinations of the two
|
||
|
! options.
|
||
|
|
||
|
*'remap'* *'noremap'*
|
||
|
'remap' boolean (default on)
|
||
|
*** ../vim-7.3.1114/src/option.c 2013-05-21 22:38:14.000000000 +0200
|
||
|
--- src/option.c 2013-06-04 21:52:13.000000000 +0200
|
||
|
***************
|
||
|
*** 7647,7681 ****
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
- /* If 'number' is set, reset 'relativenumber'. */
|
||
|
- /* If 'relativenumber' is set, reset 'number'. */
|
||
|
- else if ((int *)varp == &curwin->w_p_nu && curwin->w_p_nu)
|
||
|
- {
|
||
|
- 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;
|
||
|
- }
|
||
|
- 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)
|
||
|
{
|
||
|
/* when 'readonly' is reset globally, also reset readonlymode */
|
||
|
--- 7647,7652 ----
|
||
|
*** ../vim-7.3.1114/src/screen.c 2013-05-06 04:21:35.000000000 +0200
|
||
|
--- src/screen.c 2013-06-04 22:04:39.000000000 +0200
|
||
|
***************
|
||
|
*** 2329,2343 ****
|
||
|
if (len > w + 1)
|
||
|
len = w + 1;
|
||
|
|
||
|
! if (wp->w_p_nu)
|
||
|
! /* 'number' */
|
||
|
num = (long)lnum;
|
||
|
else
|
||
|
{
|
||
|
/* 'relativenumber', don't use negative numbers */
|
||
|
num = labs((long)get_cursor_rel_lnum(wp, lnum));
|
||
|
! if (num == 0)
|
||
|
{
|
||
|
num = lnum;
|
||
|
fmt = "%-*ld ";
|
||
|
}
|
||
|
--- 2329,2345 ----
|
||
|
if (len > w + 1)
|
||
|
len = w + 1;
|
||
|
|
||
|
! if (wp->w_p_nu && !wp->w_p_rnu)
|
||
|
! /* 'number' + 'norelativenumber' */
|
||
|
num = (long)lnum;
|
||
|
else
|
||
|
{
|
||
|
/* 'relativenumber', don't use negative numbers */
|
||
|
num = labs((long)get_cursor_rel_lnum(wp, lnum));
|
||
|
! if (num == 0 && wp->w_p_nu && wp->w_p_rnu)
|
||
|
{
|
||
|
+ /* 'number' + 'relativenumber': cursor line shows absolute
|
||
|
+ * line number */
|
||
|
num = lnum;
|
||
|
fmt = "%-*ld ";
|
||
|
}
|
||
|
***************
|
||
|
*** 3499,3513 ****
|
||
|
long num;
|
||
|
char *fmt = "%*ld ";
|
||
|
|
||
|
! if (wp->w_p_nu)
|
||
|
! /* 'number' */
|
||
|
num = (long)lnum;
|
||
|
else
|
||
|
{
|
||
|
/* 'relativenumber', don't use negative numbers */
|
||
|
num = labs((long)get_cursor_rel_lnum(wp, lnum));
|
||
|
! if (num == 0)
|
||
|
{
|
||
|
num = lnum;
|
||
|
fmt = "%-*ld ";
|
||
|
}
|
||
|
--- 3501,3516 ----
|
||
|
long num;
|
||
|
char *fmt = "%*ld ";
|
||
|
|
||
|
! if (wp->w_p_nu && !wp->w_p_rnu)
|
||
|
! /* 'number' + 'norelativenumber' */
|
||
|
num = (long)lnum;
|
||
|
else
|
||
|
{
|
||
|
/* 'relativenumber', don't use negative numbers */
|
||
|
num = labs((long)get_cursor_rel_lnum(wp, lnum));
|
||
|
! if (num == 0 && wp->w_p_nu && wp->w_p_rnu)
|
||
|
{
|
||
|
+ /* 'number' + 'relativenumber' */
|
||
|
num = lnum;
|
||
|
fmt = "%-*ld ";
|
||
|
}
|
||
|
***************
|
||
|
*** 10260,10266 ****
|
||
|
int n;
|
||
|
linenr_T lnum;
|
||
|
|
||
|
! lnum = wp->w_buffer->b_ml.ml_line_count;
|
||
|
|
||
|
if (lnum == wp->w_nrwidth_line_count)
|
||
|
return wp->w_nrwidth_width;
|
||
|
--- 10263,10274 ----
|
||
|
int n;
|
||
|
linenr_T lnum;
|
||
|
|
||
|
! if (wp->w_p_rnu && !wp->w_p_nu)
|
||
|
! /* cursor line shows "0" */
|
||
|
! lnum = wp->w_height;
|
||
|
! else
|
||
|
! /* cursor line shows absolute line number */
|
||
|
! lnum = wp->w_buffer->b_ml.ml_line_count;
|
||
|
|
||
|
if (lnum == wp->w_nrwidth_line_count)
|
||
|
return wp->w_nrwidth_width;
|
||
|
*** ../vim-7.3.1114/src/testdir/test89.in 2013-04-24 15:47:11.000000000 +0200
|
||
|
--- src/testdir/test89.in 2013-06-04 21:59:01.000000000 +0200
|
||
|
***************
|
||
|
*** 1,4 ****
|
||
|
--- 1,6 ----
|
||
|
Some tests for setting 'number' and 'relativenumber'
|
||
|
+ This is not all that useful now that the options are no longer reset when
|
||
|
+ setting the other.
|
||
|
|
||
|
STARTTEST
|
||
|
:so small.vim
|
||
|
*** ../vim-7.3.1114/src/testdir/test89.ok 2013-03-13 20:42:28.000000000 +0100
|
||
|
--- src/testdir/test89.ok 2013-06-04 21:58:09.000000000 +0200
|
||
|
***************
|
||
|
*** 1,9 ****
|
||
|
results:
|
||
|
|
||
|
! nonumber
|
||
|
relativenumber
|
||
|
|
||
|
! nonumber
|
||
|
relativenumber
|
||
|
:setlocal must NOT reset the other global value
|
||
|
|
||
|
--- 1,9 ----
|
||
|
results:
|
||
|
|
||
|
! number
|
||
|
relativenumber
|
||
|
|
||
|
! number
|
||
|
relativenumber
|
||
|
:setlocal must NOT reset the other global value
|
||
|
|
||
|
***************
|
||
|
*** 12,22 ****
|
||
|
relativenumber
|
||
|
:setglobal MUST reset the other global value
|
||
|
|
||
|
! nonumber
|
||
|
|
||
|
! norelativenumber
|
||
|
:set MUST reset the other global value
|
||
|
|
||
|
! nonumber
|
||
|
|
||
|
! norelativenumber
|
||
|
--- 12,22 ----
|
||
|
relativenumber
|
||
|
:setglobal MUST reset the other global value
|
||
|
|
||
|
! number
|
||
|
|
||
|
! relativenumber
|
||
|
:set MUST reset the other global value
|
||
|
|
||
|
! number
|
||
|
|
||
|
! relativenumber
|
||
|
*** ../vim-7.3.1114/src/version.c 2013-06-04 21:42:19.000000000 +0200
|
||
|
--- src/version.c 2013-06-04 22:11:05.000000000 +0200
|
||
|
***************
|
||
|
*** 730,731 ****
|
||
|
--- 730,733 ----
|
||
|
{ /* Add new patch number below this line */
|
||
|
+ /**/
|
||
|
+ 1115,
|
||
|
/**/
|
||
|
|
||
|
--
|
||
|
From "know your smileys":
|
||
|
:----} You lie like Pinocchio
|
||
|
|
||
|
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
||
|
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
||
|
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
||
|
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|