]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1777: Mouse click to open fold doesn't work with utf-8 "foldclose" chars v9.1.1777
authorzeertzjq <zeertzjq@outlook.com>
Sat, 20 Sep 2025 14:16:57 +0000 (14:16 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 20 Sep 2025 14:16:57 +0000 (14:16 +0000)
Problem:  Mouse click to open fold doesn't work with utf-8 "foldclose"
          chars (Balki)
Solution: Use ScreenLinesUC[off] if it is set (zeertzjq).

fixes: #18344
closes: #18349

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/mouse.c
src/testdir/test_termcodes.vim
src/version.c

index 8789eedc35f0f03f572a69e1491bad9fec1ed96e..1f657b1b09a02672ca2a671cac060916dd2487bb 100644 (file)
@@ -2109,7 +2109,8 @@ retnomove:
 #ifdef FEAT_FOLDING
        // Remember the character under the mouse, it might be a '-' or '+' in
        // the fold column.
-       mouse_char = ScreenLines[off];
+       mouse_char = enc_utf8 && ScreenLinesUC[off] != 0
+                                      ? ScreenLinesUC[off] : ScreenLines[off];
 #endif
     }
 
index bc31cdafa3394f9d9d166fbc16bea6247aa943e0..652a1bf8c18c8369b47f7eb80921c2d49acfd62f 100644 (file)
@@ -1068,7 +1068,7 @@ func Test_mouse_alt_leftclick()
   bw!
 endfunc
 
-func Test_xterm_mouse_click_in_fold_columns()
+func Run_test_xterm_mouse_click_in_fold_columns()
   new
   let save_mouse = &mouse
   let save_term = &term
@@ -1120,6 +1120,15 @@ func Test_xterm_mouse_click_in_fold_columns()
   bwipe!
 endfunc
 
+func Test_xterm_mouse_click_in_fold_columns()
+  call Run_test_xterm_mouse_click_in_fold_columns()
+  set fillchars+=foldclose:▶
+  call Run_test_xterm_mouse_click_in_fold_columns()
+  set fillchars-=foldclose:▶ fillchars+=foldclose:!
+  call Run_test_xterm_mouse_click_in_fold_columns()
+  set fillchars&
+endfunc
+
 " Left or right click in Ex command line sets position of the cursor.
 func Test_term_mouse_click_in_cmdline_to_set_pos()
   let save_mouse = &mouse
index be217095ac68748af72f17114d6c2f22f4ad4928..80affcf8d588be42de73f02b52a51ba46a284d1b 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1777,
 /**/
     1776,
 /**/