Mercurial > vim
diff src/testdir/test_visual.vim @ 30725:1cbb01bc75c3 v9.0.0697
patch 9.0.0697: cursor in wrong position with Visual substitute
Commit: https://github.com/vim/vim/commit/16dab41537ae206f4cab676ad53edbae5fd5fb45
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 8 16:41:32 2022 +0100
patch 9.0.0697: cursor in wrong position with Visual substitute
Problem: Cursor in wrong position with Visual substitute.
Solution: When restoring 'linebreak' mark the virtual column as invalid.
(closes #11309, closes #11311)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 08 Oct 2022 17:45:04 +0200 |
parents | 13b02c1ea0f7 |
children | 09a61a174259 |
line wrap: on
line diff
--- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1501,5 +1501,37 @@ 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