Skip to content

Commit

Permalink
patch 8.2.4899: with latin1 encoding CTRL-W might go before the cmdline
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brammool committed May 7, 2022
1 parent 70d8769 commit ef02f16
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/ex_getln.c
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/testdir/test_cmdline.vim
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -746,6 +746,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4899,
/**/
4898,
/**/
Expand Down

0 comments on commit ef02f16

Please sign in to comment.