62 lines
2.3 KiB
Diff
62 lines
2.3 KiB
Diff
From e98c88c44c308edaea5994b8ad4363e65030968c Mon Sep 17 00:00:00 2001
|
||
From: Bram Moolenaar <Bram@vim.org>
|
||
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 a8e695c..96f47bd 100644
|
||
--- a/src/edit.c
|
||
+++ b/src/edit.c
|
||
@@ -1741,8 +1741,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 a233e40..f35ec1e 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_cmdline.vim b/src/testdir/test_cmdline.vim
|
||
index f0498a1..08e2de7 100644
|
||
--- a/src/testdir/test_cmdline.vim
|
||
+++ b/src/testdir/test_cmdline.vim
|
||
@@ -3439,4 +3439,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.36.1
|
||
|