mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
fix(folds): fix missing virt_lines above when fold is hidden (#24274)
This commit is contained in:
parent
36941942d6
commit
811140e276
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user