mirror of
https://github.com/neovim/neovim
synced 2025-07-19 10:41:48 +00:00
fix(folds): fix missing virt_lines above when fold is hidden (#24274)
This commit is contained in:
@ -1187,9 +1187,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
|
|||||||
wlv.boguscols = 0; \
|
wlv.boguscols = 0; \
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startrow > endrow) { // past the end already!
|
assert(startrow < endrow);
|
||||||
return startrow;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLEAR_FIELD(wlv);
|
CLEAR_FIELD(wlv);
|
||||||
|
|
||||||
|
@ -2235,7 +2235,7 @@ static void win_update(win_T *wp, DecorProviders *providers)
|
|||||||
|
|
||||||
// Display one line
|
// Display one line
|
||||||
spellvars_T zero_spv = { 0 };
|
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.fi_lines > 0 ? &zero_spv : &spv,
|
||||||
foldinfo, &line_providers, &provider_err);
|
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
|
// 2: occupies two display cells
|
||||||
int start_dirty = -1, end_dirty = 0;
|
int start_dirty = -1, end_dirty = 0;
|
||||||
|
|
||||||
|
assert(row < grid->rows);
|
||||||
// TODO(bfredl): check all callsites and eliminate
|
// TODO(bfredl): check all callsites and eliminate
|
||||||
// Check for illegal row and col, just in case
|
// Check for illegal col, just in case
|
||||||
if (row >= grid->rows) {
|
|
||||||
row = grid->rows - 1;
|
|
||||||
}
|
|
||||||
if (endcol > grid->cols) {
|
if (endcol > grid->cols) {
|
||||||
endcol = grid->cols;
|
endcol = grid->cols;
|
||||||
}
|
}
|
||||||
|
@ -2427,6 +2427,83 @@ describe("folded lines", function()
|
|||||||
{11:-- VISUAL LINE --} |
|
{11:-- VISUAL LINE --} |
|
||||||
]])
|
]])
|
||||||
end
|
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)
|
end)
|
||||||
|
|
||||||
it('Folded and Visual highlights are combined #19691', function()
|
it('Folded and Visual highlights are combined #19691', function()
|
||||||
|
Reference in New Issue
Block a user