aboutsummaryrefslogtreecommitdiff
path: root/test/old
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-08 19:10:27 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-02-08 19:20:07 +0800
commitda3facb7eea92bd4082bb6ea12e0947580a63962 (patch)
tree3e3d5ea83be6645989097e75ef3e88cf87c02583 /test/old
parent1c2b9e8dd8c3fba1ac8f45aef476d6933c9e7017 (diff)
downloadrneovim-da3facb7eea92bd4082bb6ea12e0947580a63962.tar.gz
rneovim-da3facb7eea92bd4082bb6ea12e0947580a63962.tar.bz2
rneovim-da3facb7eea92bd4082bb6ea12e0947580a63962.zip
vim-patch:9.1.0083: Redrawing can be improved when deleting lines with 'number'
Problem: Redrawing can be improved when inserting/deleting lines with 'number'. Solution: Only redraw the number column of lines below changed lines. Add a test as this wasn't previously tested. (zeertzjq) closes: vim/vim#13985 https://github.com/vim/vim/commit/ae07ebc04b0726e12b1af39d52e01d86ae79ef0a
Diffstat (limited to 'test/old')
-rw-r--r--test/old/testdir/test_number.vim33
1 files changed, 28 insertions, 5 deletions
diff --git a/test/old/testdir/test_number.vim b/test/old/testdir/test_number.vim
index 6ac3c4cfe4..b57c1ed2c5 100644
--- a/test/old/testdir/test_number.vim
+++ b/test/old/testdir/test_number.vim
@@ -146,8 +146,7 @@ func Test_number_with_linewrap1()
call s:close_windows()
endfunc
-" Pending: https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI
-func XTest_number_with_linewrap2()
+func Test_number_with_linewrap2()
call s:test_windows(3, 20)
normal! 61ia
setl number wrap
@@ -164,8 +163,7 @@ func XTest_number_with_linewrap2()
call s:close_windows()
endfunc
-" Pending: https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI
-func XTest_number_with_linewrap3()
+func Test_number_with_linewrap3()
call s:test_windows(4, 20)
normal! 81ia
setl number wrap
@@ -174,7 +172,7 @@ func XTest_number_with_linewrap3()
call s:validate_cursor()
let lines = s:screen_lines(1, 4)
let expect = [
-\ "aaaaaaaa",
+\ "<<<aaaaa",
\ "aaaaaaaa",
\ "aaaaaaaa",
\ "a ",
@@ -349,6 +347,31 @@ func Test_relativenumber_callback()
call StopVimInTerminal(buf)
endfunc
+" Test that line numbers below inserted/deleted lines are updated.
+func Test_number_insert_delete_lines()
+ CheckScreendump
+
+ let lines =<< trim END
+ call setline(1, range(1, 7))
+ set number
+ call cursor(2, 1)
+ END
+ call writefile(lines, 'Xnumber_insert_delete_lines', 'D')
+
+ let buf = RunVimInTerminal('-S Xnumber_insert_delete_lines', #{rows: 8})
+ call VerifyScreenDump(buf, 'Test_number_insert_delete_lines_1', {})
+ call term_sendkeys(buf, "dd")
+ call VerifyScreenDump(buf, 'Test_number_insert_delete_lines_2', {})
+ call term_sendkeys(buf, "P")
+ call VerifyScreenDump(buf, 'Test_number_insert_delete_lines_1', {})
+ call term_sendkeys(buf, "2dd")
+ call VerifyScreenDump(buf, 'Test_number_insert_delete_lines_3', {})
+ call term_sendkeys(buf, "P")
+ call VerifyScreenDump(buf, 'Test_number_insert_delete_lines_1', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" Test for displaying line numbers with 'rightleft'
func Test_number_rightleft()
CheckFeature rightleft