aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-29 06:48:29 +0800
committerGitHub <noreply@github.com>2024-02-29 06:48:29 +0800
commite592657df8f727a3ce3b254fc72c027e36e08739 (patch)
tree1dceff7e494e8478c1d4a3bc5b6ac35c5d73febd /test
parentf912030d4ed0998b3de90bad9f1b416fffff49c9 (diff)
downloadrneovim-e592657df8f727a3ce3b254fc72c027e36e08739.tar.gz
rneovim-e592657df8f727a3ce3b254fc72c027e36e08739.tar.bz2
rneovim-e592657df8f727a3ce3b254fc72c027e36e08739.zip
vim-patch:9.1.0141: Put in Visual mode wrong if it replaces fold marker (#27661)
Problem: Put in Visual mode wrong if it replaces fold marker. Solution: Temporarily disable folding during put in Visual mode. (zeertzjq) fixes: vim/vim#14097 closes: vim/vim#14100 https://github.com/vim/vim/commit/4e141c66b9104136ddcf9cc240d2fbc83d825a5a
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_put.vim28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/old/testdir/test_put.vim b/test/old/testdir/test_put.vim
index 69fd4643c1..b1cf268a58 100644
--- a/test/old/testdir/test_put.vim
+++ b/test/old/testdir/test_put.vim
@@ -294,5 +294,33 @@ func Test_put_in_last_displayed_line()
call StopVimInTerminal(buf)
endfunc
+func Test_put_visual_replace_whole_fold()
+ new
+ let lines = repeat(['{{{1', 'foo', 'bar', ''], 2)
+ call setline(1, lines)
+ setlocal foldmethod=marker
+ call setreg('"', 'baz')
+ call setreg('1', '')
+ normal! Vp
+ call assert_equal("{{{1\nfoo\nbar\n\n", getreg('1'))
+ call assert_equal(['baz', '{{{1', 'foo', 'bar', ''], getline(1, '$'))
+
+ bwipe!
+endfunc
+
+func Test_put_visual_replace_fold_marker()
+ new
+ let lines = repeat(['{{{1', 'foo', 'bar', ''], 4)
+ call setline(1, lines)
+ setlocal foldmethod=marker
+ normal! Gkzo
+ call setreg('"', '{{{1')
+ call setreg('1', '')
+ normal! Vp
+ call assert_equal("{{{1\n", getreg('1'))
+ call assert_equal(lines, getline(1, '$'))
+
+ bwipe!
+endfunc
" vim: shiftwidth=2 sts=2 expandtab