To: vim_dev@googlegroups.com
Subject: Patch 7.3.787
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.787
Problem: With 'relativenumber' set it is not possible to see the absolute
line number.
Solution: For the cursor line show the absolute line number instead of a
zero. (Nazri Ramliy)
Files: src/screen.c
*** ../vim-7.3.786/src/screen.c 2012-12-05 16:10:21.000000000 +0100
--- src/screen.c 2013-01-30 12:29:33.000000000 +0100
***************
*** 2319,2324 ****
--- 2319,2325 ----
{
int w = number_width(wp);
long num;
+ char *fmt = "%*ld ";
if (len > w + 1)
len = w + 1;
***************
*** 2327,2336 ****
/* 'number' */
num = (long)lnum;
else
/* 'relativenumber', don't use negative numbers */
num = labs((long)get_cursor_rel_lnum(wp, lnum));
! sprintf((char *)buf, "%*ld ", w, num);
#ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
/* the line number isn't reversed */
--- 2328,2344 ----
/* '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 ";
+ }
+ }
! sprintf((char *)buf, fmt, w, num);
#ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
/* the line number isn't reversed */
***************
*** 3484,3498 ****
)
{
long num;
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));
! sprintf((char *)extra, "%*ld ",
number_width(wp), num);
if (wp->w_skipcol > 0)
for (p_extra = extra; *p_extra == ' '; ++p_extra)
--- 3492,3514 ----
)
{
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 ";
+ }
+ }
! sprintf((char *)extra, fmt,
number_width(wp), num);
if (wp->w_skipcol > 0)
for (p_extra = extra; *p_extra == ' '; ++p_extra)
***************
*** 3513,3519 ****
* the current line differently.
* TODO: Can we use CursorLine instead of CursorLineNr
* when CursorLineNr isn't set? */
! if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
char_attr = hl_attr(HLF_CLN);
#endif
}
--- 3529,3536 ----
* the current line differently.
* TODO: Can we use CursorLine instead of CursorLineNr
* when CursorLineNr isn't set? */
! if ((wp->w_p_cul || wp->w_p_rnu)
! && lnum == wp->w_cursor.lnum)
char_attr = hl_attr(HLF_CLN);
#endif
}
***************
*** 10238,10249 ****
int n;
linenr_T lnum;
! if (wp->w_p_nu)
! /* 'number' */
! lnum = wp->w_buffer->b_ml.ml_line_count;
! else
! /* 'relativenumber' */
! lnum = wp->w_height;
if (lnum == wp->w_nrwidth_line_count)
return wp->w_nrwidth_width;
--- 10255,10261 ----
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;
*** ../vim-7.3.786/src/version.c 2013-01-30 11:44:33.000000000 +0100
--- src/version.c 2013-01-30 12:25:10.000000000 +0100
***************
*** 727,728 ****
--- 727,730 ----
{ /* Add new patch number below this line */
+ /**/
+ 787,
/**/
--
ARTHUR: A scratch? Your arm's off!
BLACK KNIGHT: No, it isn't.
ARTHUR: Well, what's that then?
BLACK KNIGHT: I've had worse.
The Quest for the Holy Grail (Monty Python)
/// 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 ///