patch 9.2.0295: 'showcmd' shows wrong Visual block size with 'linebreak'

Problem:  'showcmd' shows wrong Visual block size with 'linebreak' after
          end char (after 7.4.467).
Solution: Exclude 'linebreak' from end position. Also fix confusing test
          function names.

closes: #19908

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2026-04-04 08:50:46 +00:00
committed by Christian Brabandt
parent 22db4a3c57
commit 08bd9114c1
5 changed files with 26 additions and 9 deletions
+1 -1
View File
@@ -1653,7 +1653,7 @@ clear_showcmd(void)
curwin->w_p_sbr = empty_option;
#endif
getvcols(curwin, &curwin->w_cursor, &VIsual,
&leftcol, &rightcol, 0);
&leftcol, &rightcol, GETVCOL_END_EXCL_LBR);
#ifdef FEAT_LINEBREAK
p_sbr = saved_sbr;
curwin->w_p_sbr = saved_w_sbr;
@@ -2,5 +2,5 @@
|f+0#0000001#a8a8a8255|o@1> +0#0000000#ffffff0@16||+1&&|~+0#4040ff13&| @52
|x+0#0000000&@19||+1&&|~+0#4040ff13&| @52
|~| @18||+1#0000000&|~+0#4040ff13&| @52
|<+3#0000000&|a|m|e|]| |[|+|]| |2|,|4| @3|A|l@1| |[+1&&|N|o| |N|a|m|e|]| @26|0|,|0|-|1| @9|A|l@1
|-+2&&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@45|2|x|2|0| @6
|~| @18||+1#0000000&|~+0#4040ff13&| @52
|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@28|2|x|4| @6|2|,|4| @10|A|l@1|
+18 -4
View File
@@ -195,14 +195,28 @@ func Test_linebreak_reset_restore()
call StopVimInTerminal(buf)
endfunc
func Test_virtual_block()
func Test_visual_block()
call s:test_windows('setl sbr=+')
call setline(1, [
\ "REMOVE: this not",
\ "REMOVE: aaaaaaaaaaaaa",
\ ])
set showcmd showcmdloc=tabline showtabline=2 tabline=%S
if has('gui')
set guioptions-=e
endif
exe "norm! 1/^REMOVE:"
exe "norm! 0\<C-V>jf x"
exe "norm! 0\<C-V>jf "
let lines = s:screen_lines([1, 4], winwidth(0))
let expect = [
\ "2x8 ",
\ "REMOVE: this not ",
\ "REMOVE: ",
\ "+aaaaaaaaaaaaa ",
\ ]
call s:compare_lines(expect, lines)
norm! x
set showcmd& showcmdloc& showtabline& tabline& guioptions&
$put
let lines = s:screen_lines([1, 4], winwidth(0))
let expect = [
@@ -215,7 +229,7 @@ func Test_virtual_block()
call s:close_windows()
endfunc
func Test_virtual_block_and_vbA()
func Test_visual_block_and_vbA()
call s:test_windows()
call setline(1, "long line: " . repeat("foobar ", 40) . "TARGET at end")
exe "norm! $3B\<C-v>eAx\<Esc>"
@@ -236,7 +250,7 @@ func Test_virtual_block_and_vbA()
call s:close_windows()
endfunc
func Test_virtual_char_and_block()
func Test_visual_char_and_block()
call s:test_windows()
call setline(1, "1111-1111-1111-11-1111-1111-1111")
exe "norm! 0f-lv3lc2222\<Esc>bgj."
+3 -2
View File
@@ -412,11 +412,12 @@ func Test_visual_block_hl_with_linebreak()
setlocal nolinebreak
call setline(1, [repeat('x', 15), repeat('x', 10), repeat('x', 10)])
call prop_type_add('test', {})
call prop_add(2, 5, #{text: "foo: ",type: "test"})
call prop_add(3, 5, #{text: "bar: ",type: "test"})
call prop_add(2, 5, #{text: "foo: ", type: "test"})
call prop_add(3, 5, #{text: "bar: ", type: "test"})
exe "normal! gg02l\<C-V>2j2l"
endfunc
set laststatus=0 showcmd ruler
" FIXME: clipboard=autoselect sometimes changes Visual highlight
set clipboard=
END
+2
View File
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
295,
/**/
294,
/**/