diff options
-rw-r--r-- | src/nvim/grid.c | 9 | ||||
-rw-r--r-- | test/functional/legacy/scroll_opt_spec.lua | 8 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/nvim/grid.c b/src/nvim/grid.c index 7745daf69a..2c548e11f1 100644 --- a/src/nvim/grid.c +++ b/src/nvim/grid.c @@ -503,6 +503,7 @@ void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol, int cle int col = 0; bool redraw_next; // redraw_this for next character bool clear_next = false; + bool topline = row == 0; int char_cells; // 1: normal char // 2: occupies two display cells int start_dirty = -1, end_dirty = 0; @@ -529,6 +530,14 @@ void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol, int cle max_off_from = linebuf_size; max_off_to = grid->line_offset[row] + (size_t)grid->cols; + if (topline && wp->w_skipcol > 0) { + // Take care of putting "<<<" on the first line for 'smoothscroll'. + for (int i = 0; i < 3; i++) { + schar_from_ascii(linebuf_char[i], '<'); + linebuf_attr[i] = HL_ATTR(HLF_AT); + } + } + if (rlflag) { // Clear rest first, because it's left of the text. if (clear_width > 0) { diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 20976089e2..ddbeca1a30 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -49,7 +49,7 @@ describe('smoothscroll', function() | ]] local s2 = [[ - word word word word word word word word | + <<<d word word word word word word word | word word word word | line three | long word long word long word long word | @@ -63,7 +63,7 @@ describe('smoothscroll', function() | ]] local s3 = [[ - word word word word | + <<<d word word word | line three | long word long word long word long word | long word long word long word | @@ -91,7 +91,7 @@ describe('smoothscroll', function() | ]] local s5 = [[ - word word word word | + <<<d word word word | line three | long word long word long word long word | long word long word long word | @@ -105,7 +105,7 @@ describe('smoothscroll', function() | ]] local s6 = [[ - word word word word word word word word | + <<<d word word word word word word word | word word word word | line three | long word long word long word long word | |