diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-10-09 18:57:22 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-10-09 19:09:32 +0800 |
commit | 7cdaa74b3684d40a6e72bbf3eb4deedb0c5df7bc (patch) | |
tree | 231f218ee561e64030dd383e23f9926600c9cd17 /src | |
parent | c93fd83df206c2438a735d6d99e640db1976f2f0 (diff) | |
download | rneovim-7cdaa74b3684d40a6e72bbf3eb4deedb0c5df7bc.tar.gz rneovim-7cdaa74b3684d40a6e72bbf3eb4deedb0c5df7bc.tar.bz2 rneovim-7cdaa74b3684d40a6e72bbf3eb4deedb0c5df7bc.zip |
vim-patch:9.0.0702: incomplete testing cursor position with 'linebreak' set
Problem: Incomplete testing cursor position after change with 'linebreak'
set.
Solution: Add a test and move test cases together. (closes vim/vim#11313)
https://github.com/vim/vim/commit/30c0c467d6cc2a7af960ccb9002b50115b0e55cf
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/testdir/test_listlbr.vim | 31 | ||||
-rw-r--r-- | src/nvim/testdir/test_visual.vim | 33 |
2 files changed, 25 insertions, 39 deletions
diff --git a/src/nvim/testdir/test_listlbr.vim b/src/nvim/testdir/test_listlbr.vim index 8598c0d963..1cbdba5d76 100644 --- a/src/nvim/testdir/test_listlbr.vim +++ b/src/nvim/testdir/test_listlbr.vim @@ -134,22 +134,41 @@ func Test_linebreak_with_visual_operations() call s:close_windows() endfunc +" Test that cursor is drawn at correct position after an operator when +" 'linebreak' is enabled. func Test_linebreak_reset_restore() CheckScreendump + " f_wincol() calls validate_cursor() let lines =<< trim END - vim9script - &linebreak = true - &showcmd = true - &showmode = false - ('a'->repeat(&columns - 10) .. ' ' .. 'b'->repeat(10) .. ' c')->setline(1) + set linebreak showcmd noshowmode formatexpr=wincol()-wincol() + call setline(1, repeat('a', &columns - 10) .. ' bbbbbbbbbb c') END call writefile(lines, 'XlbrResetRestore', 'D') let buf = RunVimInTerminal('-S XlbrResetRestore', {'rows': 8}) - call term_sendkeys(buf, '$v$s') + call term_sendkeys(buf, '$v$') + call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])}) + call term_sendkeys(buf, 'zo') + call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])}) + + call term_sendkeys(buf, '$v$') + call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])}) + call term_sendkeys(buf, 'gq') + call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])}) + + call term_sendkeys(buf, "$\<C-V>$") + call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])}) + call term_sendkeys(buf, 'I') + call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])}) + + call term_sendkeys(buf, "\<Esc>$v$") + call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])}) + call term_sendkeys(buf, 's') + call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])}) call VerifyScreenDump(buf, 'Test_linebreak_reset_restore_1', {}) + " clean up call term_sendkeys(buf, "\<Esc>") call StopVimInTerminal(buf) endfunc diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index faa6b2c1c3..65665d36c0 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -1492,37 +1492,4 @@ func Test_switch_buffer_ends_visual_mode() exe 'bwipe!' buf2 endfunc -" Test that cursor is drawn at correct position after an operator in Visual -" mode when 'linebreak' and 'showcmd' are enabled. -func Test_visual_operator_with_linebreak() - CheckRunVimInTerminal - - let lines =<< trim END - set linebreak showcmd noshowmode - call setline(1, repeat('a', &columns - 10) .. ' bbbbbbbbbb c') - END - call writefile(lines, 'XTest_visual_op_linebreak', 'D') - - let buf = RunVimInTerminal('-S XTest_visual_op_linebreak', {'rows': 6}) - - call term_sendkeys(buf, '$v$') - call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])}) - call term_sendkeys(buf, 'zo') - call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])}) - - call term_sendkeys(buf, "$\<C-V>$") - call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])}) - call term_sendkeys(buf, 'I') - call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])}) - - call term_sendkeys(buf, "\<Esc>$v$") - call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])}) - call term_sendkeys(buf, 's') - call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])}) - - " clean up - call term_sendkeys(buf, "\<Esc>") - call StopVimInTerminal(buf) -endfunc - " vim: shiftwidth=2 sts=2 expandtab |