aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_visual.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-09 18:48:32 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-10-09 18:58:30 +0800
commitc93fd83df206c2438a735d6d99e640db1976f2f0 (patch)
tree5351b62965463dcb6822bd86b80e3f1c8ec34c2a /src/nvim/testdir/test_visual.vim
parent603c6b6996eb7e04d50fe5544754669a06af73e0 (diff)
downloadrneovim-c93fd83df206c2438a735d6d99e640db1976f2f0.tar.gz
rneovim-c93fd83df206c2438a735d6d99e640db1976f2f0.tar.bz2
rneovim-c93fd83df206c2438a735d6d99e640db1976f2f0.zip
vim-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 vim/vim#11309, closes vim/vim#11311) https://github.com/vim/vim/commit/16dab41537ae206f4cab676ad53edbae5fd5fb45 N/A patches for version.c: vim-patch:9.0.0699: tiny build fails Problem: Tiny build fails. Solution: Add #ifdef. https://github.com/vim/vim/commit/bf499c0e6f30a94fe062f83ea0190f93178d0d74
Diffstat (limited to 'src/nvim/testdir/test_visual.vim')
-rw-r--r--src/nvim/testdir/test_visual.vim32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim
index 9c1ad0c099..faa6b2c1c3 100644
--- a/src/nvim/testdir/test_visual.vim
+++ b/src/nvim/testdir/test_visual.vim
@@ -1492,5 +1492,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