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 <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2025-09-20 14:16:57 +00:00
committed by Christian Brabandt
parent e19a882ffc
commit 8b5fe7d090
3 changed files with 14 additions and 2 deletions

View 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
}

View 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

View File

@ -724,6 +724,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1777,
/**/
1776,
/**/