revert(scrollbind): revert #41519 due to regressions

Problem:
Resetting w_scbind_pos to the displayed position discards pending
scroll distance. This breaks scrollbind with asymmetric folds and
leaves persistent offsets after tall virtual-line blocks. Wrapped
lines with smoothscroll also show increased follower lag.

Solution:
Revert the original change and its test. This restores the previous
behavior, including the original tall-virt_lines oscillation, while
a replacement is reviewed separately.

This reverts commit b781e95a24.

AI-assisted
This commit is contained in:
Yanuo Ma
2026-09-10 00:55:59 -04:00
committed by Lewis Russell
parent d039f19af5
commit 0c9012f295
2 changed files with 0 additions and 90 deletions

View File

@@ -2185,12 +2185,6 @@ void check_scrollbind(linenr_T vtopline_diff, int leftcol_diff)
} else {
scrolldown(curwin, -y, false);
}
// The scroll may not reach new_vtopline (tall virt_lines block).
// Sync w_scbind_pos to the actual position, else the miss repeats.
if (curwin->w_scbind_pos == new_vtopline) {
curwin->w_scbind_pos = get_vtopline(curwin);
}
}
redraw_later(curwin, UPD_VALID);

View File

@@ -439,88 +439,4 @@ describe('Scrollbind', function()
]],
})
end)
it('does not jump back and forth with a virt_lines block taller than the window', function()
n.exec_lua(function()
local lines = {} --- @type string[]
for i = 1, 20 do
lines[i] = tostring(i)
end
-- Bound window: one virt_lines block of 15 rows, window is 10 rows.
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
vim.bo.buftype = 'nofile'
local virt_lines = {} --- @type table[]
for i = 1, 15 do
virt_lines[i] = { { 'v' .. i } }
end
vim.api.nvim_buf_set_extmark(0, vim.api.nvim_create_namespace('test'), 4, 0, {
virt_lines = virt_lines,
})
vim.wo.scrollbind = true
-- Scrolled window: plain buffer.
vim.cmd.vnew()
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
vim.bo.buftype = 'nofile'
vim.wo.scrollbind = true
end)
n.feed('5<C-e>')
screen:expect({
grid = [[
^6 │v7 |
7 │v8 |
8 │v9 |
9 │v10 |
10 │v11 |
11 │v12 |
12 │v13 |
13 │v14 |
14 │v15 |
15 │6 |
{3:[Scratch] }{2:[Scratch] }|
|
]],
})
n.feed('<C-e>')
screen:expect({
grid = [[
^7 │v8 |
8 │v9 |
9 │v10 |
10 │v11 |
11 │v12 |
12 │v13 |
13 │v14 |
14 │v15 |
15 │6 |
16 │7 |
{3:[Scratch] }{2:[Scratch] }|
|
]],
})
n.feed('<C-e>')
screen:expect({
grid = [[
^8 │v9 |
9 │v10 |
10 │v11 |
11 │v12 |
12 │v13 |
13 │v14 |
14 │v15 |
15 │6 |
16 │7 |
17 │8 |
{3:[Scratch] }{2:[Scratch] }|
|
]],
})
end)
end)