aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-02-17 20:06:30 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-02-17 20:10:36 -0500
commit0735893caf90b85c7304659a0c8a02706d5a745c (patch)
tree020cdd21571f5e7ee263fb06da121557ced4fbbe /src
parent67c99ec6207221dd13f27a6215271cb8931e6d3d (diff)
downloadrneovim-0735893caf90b85c7304659a0c8a02706d5a745c.tar.gz
rneovim-0735893caf90b85c7304659a0c8a02706d5a745c.tar.bz2
rneovim-0735893caf90b85c7304659a0c8a02706d5a745c.zip
vim-patch:8.1.0668: no test for overstrike mode in the command line
Problem: No test for overstrike mode in the command line. Solution: Add a test. (Dominique Pelle, closes vim/vim#3742) https://github.com/vim/vim/commit/c0676bab92bd6488e17d05a4a70dfff993ef524e
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_cmdline.vim29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index 26f1dcc333..75832a798c 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -522,4 +522,33 @@ func Test_setcmdpos()
call assert_equal(1, setcmdpos(3))
endfunc
+func Test_cmdline_overstrike()
+ let encodings = has('multi_byte') ? [ 'utf8' ] : [ 'latin1' ]
+ let encoding_save = &encoding
+
+ for e in encodings
+ exe 'set encoding=' . e
+
+ " Test overstrike in the middle of the command line.
+ call feedkeys(":\"01234\<home>\<right>\<right>ab\<right>\<insert>cd\<enter>", 'xt')
+ call assert_equal('"0ab1cd4', @:)
+
+ " Test overstrike going beyond end of command line.
+ call feedkeys(":\"01234\<home>\<right>\<right>ab\<right>\<insert>cdefgh\<enter>", 'xt')
+ call assert_equal('"0ab1cdefgh', @:)
+
+ " Test toggling insert/overstrike a few times.
+ call feedkeys(":\"01234\<home>\<right>ab\<right>\<insert>cd\<right>\<insert>ef\<enter>", 'xt')
+ call assert_equal('"ab0cd3ef4', @:)
+ endfor
+
+ if has('multi_byte')
+ " Test overstrike with multi-byte characters.
+ call feedkeys(":\"テキストエディタ\<home>\<right>\<right>ab\<right>\<insert>cd\<enter>", 'xt')
+ call assert_equal('"テabキcdエディタ', @:)
+ endif
+
+ let &encoding = encoding_save
+endfunc
+
set cpo&