Commit: patch 9.1.1777: Mouse click to open fold doesn't work with utf-8 "foldclose" chars

5 views
Skip to first unread message

Christian Brabandt

unread,
Sep 20, 2025, 10:30:13 AMSep 20
to vim...@googlegroups.com
patch 9.1.1777: Mouse click to open fold doesn't work with utf-8 "foldclose" chars

Commit: https://github.com/vim/vim/commit/8b5fe7d0901f2d89b3f49f392b4d73cd58b8cc9d
Author: zeertzjq <zeer...@outlook.com>
Date: Sat Sep 20 14:16:57 2025 +0000

patch 9.1.1777: Mouse click to open fold doesn't work with utf-8 "foldclose" chars

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 <zeer...@outlook.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/mouse.c b/src/mouse.c
index 8789eedc3..1f657b1b0 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -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
}

diff --git a/src/testdir/test_termcodes.vim b/src/testdir/test_termcodes.vim
index bc31cdafa..652a1bf8c 100644
--- a/src/testdir/test_termcodes.vim
+++ b/src/testdir/test_termcodes.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index be217095a..80affcf8d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -724,6 +724,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1777,
/**/
1776,
/**/
Reply all
Reply to author
Forward
0 new messages