aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/drawline.c4
-rw-r--r--src/nvim/drawscreen.c2
-rw-r--r--src/nvim/grid.c6
-rw-r--r--test/functional/ui/fold_spec.lua77
4 files changed, 81 insertions, 8 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index 9bfe2da214..724d39d14b 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -1187,9 +1187,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
wlv.boguscols = 0; \
}
- if (startrow > endrow) { // past the end already!
- return startrow;
- }
+ assert(startrow < endrow);
CLEAR_FIELD(wlv);
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index 3f024c507b..260f239ca8 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -2235,7 +2235,7 @@ static void win_update(win_T *wp, DecorProviders *providers)
// Display one line
spellvars_T zero_spv = { 0 };
- row = win_line(wp, lnum, srow, foldinfo.fi_lines > 0 ? srow : wp->w_grid.rows, false,
+ row = win_line(wp, lnum, srow, wp->w_grid.rows, false,
foldinfo.fi_lines > 0 ? &zero_spv : &spv,
foldinfo, &line_providers, &provider_err);
diff --git a/src/nvim/grid.c b/src/nvim/grid.c
index 11cd691f22..aef10db414 100644
--- a/src/nvim/grid.c
+++ b/src/nvim/grid.c
@@ -508,11 +508,9 @@ void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol, int cle
// 2: occupies two display cells
int start_dirty = -1, end_dirty = 0;
+ assert(row < grid->rows);
// TODO(bfredl): check all callsites and eliminate
- // Check for illegal row and col, just in case
- if (row >= grid->rows) {
- row = grid->rows - 1;
- }
+ // Check for illegal col, just in case
if (endcol > grid->cols) {
endcol = grid->cols;
}
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua
index 2c8455753e..d3119ccc42 100644
--- a/test/functional/ui/fold_spec.lua
+++ b/test/functional/ui/fold_spec.lua
@@ -2427,6 +2427,83 @@ describe("folded lines", function()
{11:-- VISUAL LINE --} |
]])
end
+
+ feed('<Esc>gg')
+ command('botright 1split | wincmd w')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ {3:[No Name] [+] }|
+ [4:---------------------------------------------]|
+ {2:[No Name] [+] }|
+ [3:---------------------------------------------]|
+ ## grid 2
+ ^line 1 |
+ line 2 |
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ ## grid 3
+ |
+ ## grid 4
+ line 1 |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 5, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 5, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect([[
+ ^line 1 |
+ line 2 |
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ {3:[No Name] [+] }|
+ line 1 |
+ {2:[No Name] [+] }|
+ |
+ ]])
+ end
+
+ feed('<C-Y>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ {3:[No Name] [+] }|
+ [4:---------------------------------------------]|
+ {2:[No Name] [+] }|
+ [3:---------------------------------------------]|
+ ## grid 2
+ virt_line above line 1 |
+ ^line 1 |
+ line 2 |
+ virt_line below line 2 |
+ ## grid 3
+ |
+ ## grid 4
+ line 1 |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 5, sum_scroll_delta = -1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 5, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect([[
+ virt_line above line 1 |
+ ^line 1 |
+ line 2 |
+ virt_line below line 2 |
+ {3:[No Name] [+] }|
+ line 1 |
+ {2:[No Name] [+] }|
+ |
+ ]])
+ end
end)
it('Folded and Visual highlights are combined #19691', function()