]> granicus.if.org Git - vim/commitdiff
patch 9.0.0218: reading before the start of the line v9.0.0218
authorBram Moolenaar <Bram@vim.org>
Tue, 16 Aug 2022 13:51:53 +0000 (14:51 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 16 Aug 2022 13:51:53 +0000 (14:51 +0100)
Problem:    Reading before the start of the line.
Solution:   When displaying "$" check the column is not negative.

src/edit.c
src/proto/edit.pro
src/testdir/test_cmdwin.vim
src/version.c

index 0b0d174f36c3b06efefd2e47273dd5ab89fbcb1f..0b7896476a6eb2383ae45fd7ffdbdb04c62e78ba 100644 (file)
@@ -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())
index a233e401a25b6cd00f4c8ec98567883fd64fa7a1..f35ec1ed529816d10442d44e1e88a0e333254ae2 100644 (file)
@@ -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);
index d641b292305cb1b2a0a5af0c38260aab2f21c4f7..8cfb248f7480711981bb7d01545c26f3816c6a0f 100644 (file)
@@ -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
index 5c7e3a93a04a92bee59b32027d53f6709a80646b..5d9f9f77d0af7febff2cf7b2c7fc23947876fcba 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    218,
 /**/
     217,
 /**/