]> granicus.if.org Git - vim/commitdiff
patch 8.1.0668: no test for overstrike mode in the command line v8.1.0668
authorBram Moolenaar <Bram@vim.org>
Mon, 31 Dec 2018 20:03:02 +0000 (21:03 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 31 Dec 2018 20:03:02 +0000 (21:03 +0100)
Problem:    No test for overstrike mode in the command line.
Solution:   Add a test. (Dominique Pelle, closes #3742)

src/testdir/test_cmdline.vim
src/version.c

index f42d228e29f2b2c62a33e264190c3c4660acb45b..9a4ccd11d594faeaa1c46c4f2be5917069b5c2ed 100644 (file)
@@ -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&
index 21a495659a58d84f95410da2cce15be048a6bc42..486db732c3f0648b9ab8e25885e23f1f69bfe2d7 100644 (file)
@@ -799,6 +799,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    668,
 /**/
     667,
 /**/