forked from aniani/vim
updated for version 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)
This commit is contained in:
parent
02366255c9
commit
700e7345de
30
src/screen.c
30
src/screen.c
@ -2319,6 +2319,7 @@ fold_line(wp, fold_count, foldinfo, lnum, row)
|
|||||||
{
|
{
|
||||||
int w = number_width(wp);
|
int w = number_width(wp);
|
||||||
long num;
|
long num;
|
||||||
|
char *fmt = "%*ld ";
|
||||||
|
|
||||||
if (len > w + 1)
|
if (len > w + 1)
|
||||||
len = w + 1;
|
len = w + 1;
|
||||||
@ -2327,10 +2328,17 @@ fold_line(wp, fold_count, foldinfo, lnum, row)
|
|||||||
/* 'number' */
|
/* 'number' */
|
||||||
num = (long)lnum;
|
num = (long)lnum;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
/* 'relativenumber', don't use negative numbers */
|
/* 'relativenumber', don't use negative numbers */
|
||||||
num = labs((long)get_cursor_rel_lnum(wp, lnum));
|
num = labs((long)get_cursor_rel_lnum(wp, lnum));
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
num = lnum;
|
||||||
|
fmt = "%-*ld ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sprintf((char *)buf, "%*ld ", w, num);
|
sprintf((char *)buf, fmt, w, num);
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
if (wp->w_p_rl)
|
if (wp->w_p_rl)
|
||||||
/* the line number isn't reversed */
|
/* the line number isn't reversed */
|
||||||
@ -3484,15 +3492,23 @@ win_line(wp, lnum, startrow, endrow, nochange)
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
long num;
|
long num;
|
||||||
|
char *fmt = "%*ld ";
|
||||||
|
|
||||||
if (wp->w_p_nu)
|
if (wp->w_p_nu)
|
||||||
/* 'number' */
|
/* 'number' */
|
||||||
num = (long)lnum;
|
num = (long)lnum;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
/* 'relativenumber', don't use negative numbers */
|
/* 'relativenumber', don't use negative numbers */
|
||||||
num = labs((long)get_cursor_rel_lnum(wp, lnum));
|
num = labs((long)get_cursor_rel_lnum(wp, lnum));
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
num = lnum;
|
||||||
|
fmt = "%-*ld ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sprintf((char *)extra, "%*ld ",
|
sprintf((char *)extra, fmt,
|
||||||
number_width(wp), num);
|
number_width(wp), num);
|
||||||
if (wp->w_skipcol > 0)
|
if (wp->w_skipcol > 0)
|
||||||
for (p_extra = extra; *p_extra == ' '; ++p_extra)
|
for (p_extra = extra; *p_extra == ' '; ++p_extra)
|
||||||
@ -3513,7 +3529,8 @@ win_line(wp, lnum, startrow, endrow, nochange)
|
|||||||
* the current line differently.
|
* the current line differently.
|
||||||
* TODO: Can we use CursorLine instead of CursorLineNr
|
* TODO: Can we use CursorLine instead of CursorLineNr
|
||||||
* when CursorLineNr isn't set? */
|
* when CursorLineNr isn't set? */
|
||||||
if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
|
if ((wp->w_p_cul || wp->w_p_rnu)
|
||||||
|
&& lnum == wp->w_cursor.lnum)
|
||||||
char_attr = hl_attr(HLF_CLN);
|
char_attr = hl_attr(HLF_CLN);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -10238,12 +10255,7 @@ number_width(wp)
|
|||||||
int n;
|
int n;
|
||||||
linenr_T lnum;
|
linenr_T lnum;
|
||||||
|
|
||||||
if (wp->w_p_nu)
|
lnum = wp->w_buffer->b_ml.ml_line_count;
|
||||||
/* 'number' */
|
|
||||||
lnum = wp->w_buffer->b_ml.ml_line_count;
|
|
||||||
else
|
|
||||||
/* 'relativenumber' */
|
|
||||||
lnum = wp->w_height;
|
|
||||||
|
|
||||||
if (lnum == wp->w_nrwidth_line_count)
|
if (lnum == wp->w_nrwidth_line_count)
|
||||||
return wp->w_nrwidth_width;
|
return wp->w_nrwidth_width;
|
||||||
|
@ -725,6 +725,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 */
|
||||||
|
/**/
|
||||||
|
787,
|
||||||
/**/
|
/**/
|
||||||
786,
|
786,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user