# HG changeset patch # User Bram Moolenaar # Date 1651917603 -7200 # Node ID 4a9fdf708575ce618342554e7075a57e17d90141 # Parent 2a275e203f8b6c93ca77f4f0eaa1cb8278940b1e patch 8.2.4899: with latin1 encoding CTRL-W might go before the cmdline Commit: https://github.com/vim/vim/commit/ef02f16609ff0a26ffc6e20263523424980898fe Author: Bram Moolenaar Date: Sat May 7 10:49:10 2022 +0100 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. diff --git a/src/ex_getln.c b/src/ex_getln.c --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -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; diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -773,6 +773,9 @@ func Test_cmdline_remove_char() call feedkeys(":abc def\\\\"\", 'tx') call assert_equal('"def', @:, e) + + " This was going before the start in latin1. + call feedkeys(": \\", 'tx') endfor let &encoding = encoding_save diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4899, +/**/ 4898, /**/ 4897,