From e98c88c44c308edaea5994b8ad4363e65030968c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 16 Aug 2022 14:51:53 +0100 Subject: [PATCH] patch 9.0.0218: reading before the start of the line Problem: Reading before the start of the line. Solution: When displaying "$" check the column is not negative. --- src/edit.c | 3 ++- src/proto/edit.pro | 2 +- src/testdir/test_cmdline.vim | 8 ++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/edit.c b/src/edit.c index bc0b7dc..a20fd3d 100644 --- a/src/edit.c +++ b/src/edit.c @@ -1769,8 +1769,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 49b9f4c..d0d3b17 100644 --- a/src/proto/edit.pro +++ b/src/proto/edit.pro @@ -7,7 +7,7 @@ void edit_putchar(int c, int highlight); char_u *prompt_text(void); int prompt_curpos_editable(void); 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_cmdline.vim b/src/testdir/test_cmdline.vim index 735b0a5..33808d7 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -935,4 +935,12 @@ func Test_long_error_message() silent! norm Q00000000000000     000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000                                                                                                                                                                                                                         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 -- 2.33.0