diff options
Diffstat (limited to 'src/nvim')
-rw-r--r-- | src/nvim/drawline.c | 2 | ||||
-rw-r--r-- | src/nvim/grid.c | 18 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 0d701f07bb..ef9912e503 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -609,7 +609,7 @@ static void handle_lnum_col(win_T *wp, winlinevars_T *wlv, int num_signs, int si } else { // Draw the line number (empty space after wrapping). if (wlv->row == wlv->startrow + wlv->filler_lines - && (wp->w_skipcol == 0 || wlv->row > wp->w_winrow)) { + && (wp->w_skipcol == 0 || wlv->row > wp->w_winrow || (wp->w_p_nu && wp->w_p_rnu))) { get_line_number_str(wp, wlv->lnum, wlv->extra, sizeof(wlv->extra)); if (wp->w_skipcol > 0 && wlv->startrow == 0) { for (wlv->p_extra = wlv->extra; *wlv->p_extra == ' '; wlv->p_extra++) { diff --git a/src/nvim/grid.c b/src/nvim/grid.c index 0ceaeaa8b2..8431c078b9 100644 --- a/src/nvim/grid.c +++ b/src/nvim/grid.c @@ -533,9 +533,21 @@ void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol, int cle if (topline && wp->w_skipcol > 0 && *get_showbreak_value(wp) == NUL) { // Take care of putting "<<<" on the first line for 'smoothscroll' // when 'showbreak' is not set. - for (int i = 0; i < 3; i++) { - schar_from_ascii(linebuf_char[i], '<'); - linebuf_attr[i] = HL_ATTR(HLF_AT); + int off = 0; + int skip = 0; + if (wp->w_p_nu && wp->w_p_rnu) { + // do not overwrite the line number, change "123 text" to + // "123>>>xt". + while (skip < wp->w_width && ascii_isdigit(*linebuf_char[off])) { + off++; + skip++; + } + } + + for (int i = 0; i < 3 && i + skip < wp->w_width; i++) { + schar_from_ascii(linebuf_char[off], '<'); + linebuf_attr[off] = HL_ATTR(HLF_AT); + off++; } } |