fix(terminal): adjust marks when deleting scrollback lines (#36294)

This also fixes inconsistent scrolling behavior on terminal output when
cursor is in the middle of the buffer and the scrollback is full.
This commit is contained in:
zeertzjq
2025-10-25 06:48:04 +08:00
committed by GitHub
parent d909de2dc2
commit 520568f40f
7 changed files with 260 additions and 34 deletions

View File

@@ -581,7 +581,13 @@ do
if string.match(args.data.sequence, '^\027]133;A') then
local lnum = args.data.cursor[1] ---@type integer
if lnum >= 1 then
vim.api.nvim_buf_set_extmark(args.buf, nvim_terminal_prompt_ns, lnum - 1, 0, {})
vim.api.nvim_buf_set_extmark(
args.buf,
nvim_terminal_prompt_ns,
lnum - 1,
0,
{ right_gravity = false }
)
end
end
end,