Skip to content

Commit ef02f16

Browse files
committed
patch 8.2.4899: with latin1 encoding CTRL-W might go before the cmdline
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.
1 parent 70d8769 commit ef02f16

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/ex_getln.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,10 +1082,13 @@ cmdline_erase_chars(
10821082
{
10831083
while (p > ccline.cmdbuff && vim_isspace(p[-1]))
10841084
--p;
1085-
i = vim_iswordc(p[-1]);
1086-
while (p > ccline.cmdbuff && !vim_isspace(p[-1])
1087-
&& vim_iswordc(p[-1]) == i)
1088-
--p;
1085+
if (p > ccline.cmdbuff)
1086+
{
1087+
i = vim_iswordc(p[-1]);
1088+
while (p > ccline.cmdbuff && !vim_isspace(p[-1])
1089+
&& vim_iswordc(p[-1]) == i)
1090+
--p;
1091+
}
10891092
}
10901093
else
10911094
--p;

src/testdir/test_cmdline.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,9 @@ func Test_cmdline_remove_char()
773773

774774
call feedkeys(":abc def\<S-Left>\<C-U>\<C-B>\"\<CR>", 'tx')
775775
call assert_equal('"def', @:, e)
776+
777+
" This was going before the start in latin1.
778+
call feedkeys(": \<C-W>\<CR>", 'tx')
776779
endfor
777780

778781
let &encoding = encoding_save

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ static char *(features[]) =
746746

747747
static int included_patches[] =
748748
{ /* Add new patch number below this line */
749+
/**/
750+
4899,
749751
/**/
750752
4898,
751753
/**/

0 commit comments

Comments
 (0)