diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-07-03 15:08:37 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-03 15:08:37 +0200 |
commit | 9cee4a1c9c69542ccd73bcd2db05920150856361 (patch) | |
tree | 477751fae2e8cf0c5afc977127d1622fdef0e105 /src | |
parent | fcde67c99fbb6d7294e01b9e87d8d2ae7af31255 (diff) | |
download | vim-git-9cee4a1c9c69542ccd73bcd2db05920150856361.tar.gz |
patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrongv8.2.3088
Problem: With 'virtualedit' set to "block" Visual highlight is wrong after
using "$". (Marco Trosi)
Solution: Do not set w_old_cursor_lcol to MAXCOL. (closes #8495)
Diffstat (limited to 'src')
-rw-r--r-- | src/drawscreen.c | 4 | ||||
-rw-r--r-- | src/testdir/dumps/Test_visual_block_with_virtualedit.dump | 8 | ||||
-rw-r--r-- | src/testdir/test_visual.vim | 21 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 34 insertions, 1 deletions
diff --git a/src/drawscreen.c b/src/drawscreen.c index bb0d8878e..77a8a7b27 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -2007,7 +2007,9 @@ win_update(win_T *wp) ve_flags = save_ve_flags; #endif ++toc; - if (curwin->w_curswant == MAXCOL) + // Highlight to the end of the line, unless 'virtualedit' has + // "block". + if (curwin->w_curswant == MAXCOL && !(ve_flags & VE_BLOCK)) toc = MAXCOL; if (fromc != wp->w_old_cursor_fcol diff --git a/src/testdir/dumps/Test_visual_block_with_virtualedit.dump b/src/testdir/dumps/Test_visual_block_with_virtualedit.dump new file mode 100644 index 000000000..2991a633b --- /dev/null +++ b/src/testdir/dumps/Test_visual_block_with_virtualedit.dump @@ -0,0 +1,8 @@ +|a+0&#e0e0e08@5> +0&#ffffff0@43 +|b+0&#e0e0e08@3| @2| +0&#ffffff0@42 +|c+0&#e0e0e08@1| @4| +0&#ffffff0@42 +|~+0#4040ff13&| @48 +|~| @48 +|~| @48 +|~| @48 +|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@3|3|x|7| @6|1|,|7| @10|A|l@1| diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index 789ff6f60..5b2a32cfe 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -2,6 +2,7 @@ source shared.vim source check.vim +source screendump.vim func Test_block_shift_multibyte() " Uses double-wide character. @@ -1241,5 +1242,25 @@ func Test_visual_put_blockedit_zy_and_zp() bw! endfunc +func Test_visual_block_with_virtualedit() + CheckScreendump + + let lines =<< trim END + call setline(1, ['aaaaaa', 'bbbb', 'cc']) + set virtualedit=block + normal G + END + call writefile(lines, 'XTest_block') + + let buf = RunVimInTerminal('-S XTest_block', {'rows': 8, 'cols': 50}) + call term_sendkeys(buf, "\<C-V>gg$") + call VerifyScreenDump(buf, 'Test_visual_block_with_virtualedit', {}) + + " clean up + call term_sendkeys(buf, "\<Esc>") + call StopVimInTerminal(buf) + call delete('XTest_beval') +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 242b556ac..0c98a98b3 100644 --- a/src/version.c +++ b/src/version.c @@ -756,6 +756,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3088, +/**/ 3087, /**/ 3086, |