summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-12-31 21:03:02 +0100
committerBram Moolenaar <Bram@vim.org>2018-12-31 21:03:02 +0100
commitc0676bab92bd6488e17d05a4a70dfff993ef524e (patch)
tree58ae6afaec041a1d9c7ab7248bbae88e0122c887
parent2f21fa8743404289f1410ba49dd711a622f45d81 (diff)
downloadvim-git-c0676bab92bd6488e17d05a4a70dfff993ef524e.tar.gz
patch 8.1.0668: no test for overstrike mode in the command linev8.1.0668
Problem: No test for overstrike mode in the command line. Solution: Add a test. (Dominique Pelle, closes #3742)
-rw-r--r--src/testdir/test_cmdline.vim29
-rw-r--r--src/version.c2
2 files changed, 31 insertions, 0 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index f42d228e2..9a4ccd11d 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -581,4 +581,33 @@ func Test_setcmdpos()
call assert_equal(1, setcmdpos(3))
endfunc
+func Test_cmdline_overstrike()
+ let encodings = has('multi_byte') ? [ 'latin1', '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&
diff --git a/src/version.c b/src/version.c
index 21a495659..486db732c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -800,6 +800,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 668,
+/**/
667,
/**/
666,