aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2025-04-08 14:47:18 +0200
committerGitHub <noreply@github.com>2025-04-08 05:47:18 -0700
commit5b1561bb717eae8781ff62646c675c7e842e4444 (patch)
tree8b6f2293215e5cda5b969b3752f4da6e59263e66
parentc0f46daca5e6b3b5546013e2c3ed87f54fd24b9f (diff)
downloadrneovim-5b1561bb717eae8781ff62646c675c7e842e4444.tar.gz
rneovim-5b1561bb717eae8781ff62646c675c7e842e4444.tar.bz2
rneovim-5b1561bb717eae8781ff62646c675c7e842e4444.zip
fix(display): scroll redrawing doesn't account for virt_lines above fold #33374
Problem: Logic computing the new height of the modified area does not take into account virtual lines attached to a folded line. Solution: Remove `hasFolding()` branch and let `plines_win_full()` do its job.
-rw-r--r--src/nvim/drawscreen.c18
-rw-r--r--test/functional/ui/decorations_spec.lua4
2 files changed, 7 insertions, 15 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index 2905d51657..bf2bc077e0 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -2188,20 +2188,10 @@ static void win_update(win_T *wp)
// rows, and may insert/delete lines
int j = idx;
for (l = lnum; l < mod_bot; l++) {
- linenr_T first = l;
- int prev_rows = new_rows;
- if (hasFolding(wp, l, NULL, &l)) {
- new_rows += !decor_conceal_line(wp, first - 1, false);
- } else if (l == wp->w_topline) {
- int n = plines_win_nofill(wp, l, false) + wp->w_topfill
- - adjust_plines_for_skipcol(wp);
- n = MIN(n, wp->w_height_inner);
- new_rows += n;
- } else {
- new_rows += plines_win(wp, l, true);
- }
- // Do not increment when height was 0 (for a concealed line).
- j += (prev_rows != new_rows);
+ int n = plines_win_full(wp, l, &l, NULL, true, false);
+ n -= (l == wp->w_topline ? adjust_plines_for_skipcol(wp) : 0);
+ new_rows += MIN(n, wp->w_height_inner);
+ j += n > 0; // don't count concealed lines
if (new_rows > wp->w_grid.rows - row - 2) {
// it's getting too much, must redraw the rest
new_rows = 9999;
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 2f5ef790f1..7ae69ce1d6 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -2905,11 +2905,13 @@ describe('extmark decorations', function()
{2: 1 }for _,item in ipairs(items) do |
{2: }line 1 below |
{2: 6 }^ for _ = 1, (count or 1) do |
+ {2: 7 } local cell = line[colpos] |
+ {2: 8 } cell.text = text |
{2: 9 } cell.hl_id = hl_id |
{2: 10 } colpos = colpos+1 |
{2: 11 } end |
{2: 12 }end |
- {1:~ }|*7
+ {1:~ }|*5
|
]])
-- w_lines.wl_lastlnum values are valid