]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0295: 'showcmd' shows wrong Visual block size with 'linebreak' v9.2.0295
authorzeertzjq <zeertzjq@outlook.com>
Sat, 4 Apr 2026 08:50:46 +0000 (08:50 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 4 Apr 2026 08:50:46 +0000 (08:50 +0000)
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>
src/normal.c
src/testdir/dumps/Test_visual_block_hl_with_linebreak_1.dump
src/testdir/test_listlbr.vim
src/testdir/test_listlbr_utf8.vim
src/version.c

index e7be7575762d936b5928ccb84743acd50f871a98..c29fb6c25acece22b13b595922bb1aa8d15f443e 100644 (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;
index a1825a9ee2df61dbc8cc0990f882fe45180ba3d7..69bbb16772696a4afc6b7d5cbee1350fdf1df3c5 100644 (file)
@@ -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| 
index 7430ec626c8d1e1b76edeee7050723b992bca1f5..434bef3609922375df0bb1e1f2999831c27e6221 100644 (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."
index bde1a49580be46af21cd5994b3555d6dbfee3b1e..5bac070b9542a1289cd9b7da09a00e6006d50327 100644 (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
index 41d345cbae9cf2d50fd2114a84e76d406fa123b8..f0f21363c625b12b2acea51c4cd6e679dbceb38a 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    295,
 /**/
     294,
 /**/