diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-10-09 11:44:28 +0100 |
|---|---|---|
| committer | Bram Moolenaar <Bram@vim.org> | 2022-10-09 11:44:28 +0100 |
| commit | 30c0c467d6cc2a7af960ccb9002b50115b0e55cf (patch) | |
| tree | ceb6df184a9692375764560e63b32d1494a630c6 | |
| parent | 8cf3459878198c5bb4a96f3c63214b2beccce341 (diff) | |
| download | vim-git-9.0.0702.tar.gz | |
patch 9.0.0702: incomplete testing cursor position with 'linebreak' setv9.0.0702
Problem: Incomplete testing cursor position after change with 'linebreak'
set.
Solution: Add a test and move test cases together. (closes #11313)
| -rw-r--r-- | src/testdir/dumps/Test_linebreak_reset_restore_1.dump | 2 | ||||
| -rw-r--r-- | src/testdir/test_listlbr.vim | 31 | ||||
| -rw-r--r-- | src/testdir/test_visual.vim | 33 | ||||
| -rw-r--r-- | src/version.c | 2 |
4 files changed, 28 insertions, 40 deletions
diff --git a/src/testdir/dumps/Test_linebreak_reset_restore_1.dump b/src/testdir/dumps/Test_linebreak_reset_restore_1.dump index 4a63630a7..5c6db4f74 100644 --- a/src/testdir/dumps/Test_linebreak_reset_restore_1.dump +++ b/src/testdir/dumps/Test_linebreak_reset_restore_1.dump @@ -5,4 +5,4 @@ |~| @73 |~| @73 |~| @73 -| +0#0000000&@56|1|,|7|8|-|8|7| @6|A|l@1| +|E+0#ffffff16#e000002|4|9|0|:| |N|o| |f|o|l|d| |f|o|u|n|d| +0#0000000#ffffff0@37|1|,|7|8|-|8|7| @6|A|l@1| diff --git a/src/testdir/test_listlbr.vim b/src/testdir/test_listlbr.vim index ace398b18..4a43feab7 100644 --- a/src/testdir/test_listlbr.vim +++ b/src/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/testdir/test_visual.vim b/src/testdir/test_visual.vim index 71156f8ad..66a44c52c 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1501,37 +1501,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 diff --git a/src/version.c b/src/version.c index 79ec14642..0e31af346 100644 --- a/src/version.c +++ b/src/version.c @@ -700,6 +700,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 702, +/**/ 701, /**/ 700, |
