summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-16 14:51:53 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-16 14:51:53 +0100
commite98c88c44c308edaea5994b8ad4363e65030968c (patch)
treeee95f55436a1d8c2cd18a8f932adc7ac14a6b409
parente1f3fd1d02e3f5fe6d2b6d82687c6846b8e500f8 (diff)
downloadvim-git-e98c88c44c308edaea5994b8ad4363e65030968c.tar.gz
patch 9.0.0218: reading before the start of the linev9.0.0218
Problem: Reading before the start of the line. Solution: When displaying "$" check the column is not negative.
-rw-r--r--src/edit.c3
-rw-r--r--src/proto/edit.pro2
-rw-r--r--src/testdir/test_cmdwin.vim8
-rw-r--r--src/version.c2
4 files changed, 13 insertions, 2 deletions
diff --git a/src/edit.c b/src/edit.c
index 0b0d174f3..0b7896476 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -1746,8 +1746,9 @@ edit_unputchar(void)
* Only works when cursor is in the line that changes.
*/
void
-display_dollar(colnr_T col)
+display_dollar(colnr_T col_arg)
{
+ colnr_T col = col_arg < 0 ? 0 : col_arg;
colnr_T save_col;
if (!redrawing())
diff --git a/src/proto/edit.pro b/src/proto/edit.pro
index a233e401a..f35ec1ed5 100644
--- a/src/proto/edit.pro
+++ b/src/proto/edit.pro
@@ -5,7 +5,7 @@ void ins_redraw(int ready);
void edit_putchar(int c, int highlight);
void set_insstart(linenr_T lnum, int col);
void edit_unputchar(void);
-void display_dollar(colnr_T col);
+void display_dollar(colnr_T col_arg);
void undisplay_dollar(void);
void truncate_spaces(char_u *line);
void backspace_until_column(int col);
diff --git a/src/testdir/test_cmdwin.vim b/src/testdir/test_cmdwin.vim
index d641b2923..8cfb248f7 100644
--- a/src/testdir/test_cmdwin.vim
+++ b/src/testdir/test_cmdwin.vim
@@ -365,5 +365,13 @@ func Test_cant_open_cmdwin_in_cmdwin()
call assert_match('E1292:', caught)
endfunc
+func Test_cmdwin_virtual_edit()
+ enew!
+ set ve=all cpo+=$
+ silent normal q/s
+
+ set ve= cpo-=$
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 5c7e3a93a..5d9f9f77d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -736,6 +736,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 218,
+/**/
217,
/**/
216,