]> granicus.if.org Git - vim/commitdiff
patch 8.2.4899: with latin1 encoding CTRL-W might go before the cmdline v8.2.4899
authorBram Moolenaar <Bram@vim.org>
Sat, 7 May 2022 09:49:10 +0000 (10:49 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 7 May 2022 09:49:10 +0000 (10:49 +0100)
Problem:    With latin1 encoding CTRL-W might go before the start of the
            command line.
Solution:   Check already being at the start of the command line.

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

index a97024b351714d5d22cd5c61065a547ff658cd07..7020f5143a012f48f9951ea73e1a3cfafc059320 100644 (file)
@@ -1082,10 +1082,13 @@ cmdline_erase_chars(
        {
            while (p > ccline.cmdbuff && vim_isspace(p[-1]))
                --p;
-           i = vim_iswordc(p[-1]);
-           while (p > ccline.cmdbuff && !vim_isspace(p[-1])
-                   && vim_iswordc(p[-1]) == i)
-               --p;
+           if (p > ccline.cmdbuff)
+           {
+               i = vim_iswordc(p[-1]);
+               while (p > ccline.cmdbuff && !vim_isspace(p[-1])
+                       && vim_iswordc(p[-1]) == i)
+                   --p;
+           }
        }
        else
            --p;
index 474638fb00d6bf25f1158eff21abdcfe3516dfd6..5a849f77f755b32f433c2d29b88f2227df43c25b 100644 (file)
@@ -773,6 +773,9 @@ func Test_cmdline_remove_char()
 
     call feedkeys(":abc def\<S-Left>\<C-U>\<C-B>\"\<CR>", 'tx')
     call assert_equal('"def', @:, e)
+
+    " This was going before the start in latin1.
+    call feedkeys(": \<C-W>\<CR>", 'tx')
   endfor
 
   let &encoding = encoding_save
index 201d26f06eb9a36bf13c21ca431480e68df5fd5e..05888c722e8ed24553950fb4249da06160916317 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4899,
 /**/
     4898,
 /**/