0
0
mirror of https://github.com/vim/vim.git synced 2025-10-18 07:54:29 -04:00

patch 9.1.0822: topline might be changed in diff mode unexpectedly

Problem:  topline might be changed in diff mode unexpectedly
          (Jaehwang Jung)
Solution: do not re-calculate topline, when using line() func
          in diff mode.

fixes: #15812
closes: #15950

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2024-10-29 20:29:04 +01:00
parent 203c7225f5
commit 05a40e07c2
7 changed files with 115 additions and 0 deletions

View File

@@ -2258,4 +2258,31 @@ func Test_diff_overlapped_diff_blocks_will_be_merged()
call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["a", "b", "y", "c"])
call VerifyBoth(buf, "Test_diff_overlapped_3.37", "")
call StopVimInTerminal(buf)
endfunc
" switching windows in diff mode caused an unneccessary scroll
func Test_diff_topline_noscroll()
CheckScreendump
let content =<< trim END
call setline(1, range(1,60))
vnew
call setline(1, range(1,10) + range(50,60))
windo diffthis
norm! G
exe "norm! 30\<C-y>"
END
call writefile(content, 'Xcontent', 'D')
let buf = RunVimInTerminal('-S Xcontent', {'rows': 20})
call VerifyScreenDump(buf, 'Test_diff_topline_1', {})
call term_sendkeys(buf, ":echo line('w0', 1001)\<cr>")
call term_wait(buf)
call VerifyScreenDump(buf, 'Test_diff_topline_2', {})
call term_sendkeys(buf, "\<C-W>p")
call term_wait(buf)
call VerifyScreenDump(buf, 'Test_diff_topline_3', {})
call term_sendkeys(buf, "\<C-W>p")
call term_wait(buf)
call VerifyScreenDump(buf, 'Test_diff_topline_4', {})
call StopVimInTerminal(buf)