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

Commit: 
https://github.com/vim/vim/commit/08bd9114c17e1dc8fb234cd5362e77db8be3aad5
Author: zeertzjq <[email protected]>
Date:   Sat Apr 4 08:50:46 2026 +0000

    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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/normal.c b/src/normal.c
index e7be75757..c29fb6c25 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -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;
diff --git a/src/testdir/dumps/Test_visual_block_hl_with_linebreak_1.dump 
b/src/testdir/dumps/Test_visual_block_hl_with_linebreak_1.dump
index a1825a9ee..69bbb1677 100644
--- a/src/testdir/dumps/Test_visual_block_hl_with_linebreak_1.dump
+++ b/src/testdir/dumps/Test_visual_block_hl_with_linebreak_1.dump
@@ -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| 
diff --git a/src/testdir/test_listlbr.vim b/src/testdir/test_listlbr.vim
index 7430ec626..434bef360 100644
--- a/src/testdir/test_listlbr.vim
+++ b/src/testdir/test_listlbr.vim
@@ -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."
diff --git a/src/testdir/test_listlbr_utf8.vim 
b/src/testdir/test_listlbr_utf8.vim
index bde1a4958..5bac070b9 100644
--- a/src/testdir/test_listlbr_utf8.vim
+++ b/src/testdir/test_listlbr_utf8.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index 41d345cba..f0f21363c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    295,
 /**/
     294,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1w8wrM-003SfX-65%40256bit.org.

Raspunde prin e-mail lui