{
int w = number_width(wp);
long num;
+ char *fmt = "%*ld ";
if (len > w + 1)
len = w + 1;
/* '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, "%*ld ", w, num);
+ sprintf((char *)buf, fmt, w, num);
#ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
/* the line number isn't reversed */
)
{
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, "%*ld ",
+ sprintf((char *)extra, fmt,
number_width(wp), num);
if (wp->w_skipcol > 0)
for (p_extra = extra; *p_extra == ' '; ++p_extra)
* 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)
+ if ((wp->w_p_cul || wp->w_p_rnu)
+ && lnum == wp->w_cursor.lnum)
char_attr = hl_attr(HLF_CLN);
#endif
}
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;
+ lnum = wp->w_buffer->b_ml.ml_line_count;
if (lnum == wp->w_nrwidth_line_count)
return wp->w_nrwidth_width;