From 8c5d81997e56a72fbb1392846a146cab2eb74b7f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 12 Aug 2023 06:41:23 +0800 Subject: vim-patch:9.0.1693: Ctrl-Q not handled like Ctrl-V in replace mode (#24669) Problem: Ctrl-Q not handled like Ctrl-V in replace mode Solution: Handle Ctrl-Q like Ctrl-V closes: vim/vim#12686 closes: vim/vim#12684 https://github.com/vim/vim/commit/2d63e4b3ccc0bb34db21a3c1d024cb114f8c4071 Co-authored-by: Christian Brabandt --- test/old/testdir/test_normal.vim | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index 23baebb78c..c8e78dcf93 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -4011,4 +4011,42 @@ func Test_normal_j_below_botline() call StopVimInTerminal(buf) endfunc +" Test for r (replace) command with CTRL_V and CTRL_Q +func Test_normal_r_ctrl_v_cmd() + new + call append(0, 'This is a simple test: abcd') + exe "norm! 1gg$r\\" + call assert_equal(['This is a simple test: abc', ''], getline(1,'$')) + exe "norm! 1gg$hr\\" + call assert_equal(['This is a simple test: ab', ''], getline(1,'$')) + exe "norm! 1gg$2hr\x7e" + call assert_equal(['This is a simple test: a~', ''], getline(1,'$')) + exe "norm! 1gg$3hr\x7e" + call assert_equal(['This is a simple test: ~~', ''], getline(1,'$')) + + if &encoding == 'utf-8' + exe "norm! 1gg$4hr\u20ac" + call assert_equal(['This is a simple test:€~~', ''], getline(1,'$')) + exe "norm! 1gg$5hr\u20ac" + call assert_equal(['This is a simple test€€~~', ''], getline(1,'$')) + exe "norm! 1gg0R\xff WAS \" + call assert_equal(['ÿ WAS a simple test€€~~', ''], getline(1,'$')) + exe "norm! 1gg0elR\xffNOT\" + call assert_equal(['ÿ WASÿNOT simple test€€~~', ''], getline(1,'$')) + endif + + call setline(1, 'This is a simple test: abcd') + exe "norm! 1gg$gr\\" + call assert_equal(['This is a simple test: abc', ''], getline(1,'$')) + exe "norm! 1gg$hgr\\" + call assert_equal(['This is a simple test: ab ', ''], getline(1,'$')) + exe "norm! 1gg$2hgr\x7e" + call assert_equal(['This is a simple test: a~ ', ''], getline(1,'$')) + exe "norm! 1gg$3hgr\x7e" + call assert_equal(['This is a simple test: ~~ ', ''], getline(1,'$')) + + " clean up + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit