Skip to content
Permalink
Browse files

mouse.c: can click on multibyte foldopen/foldclose (#11863)

would previously only work with ascii fillchars.

Added a test.
  • Loading branch information
teto committed Feb 14, 2020
1 parent 61c98a1 commit bb331a9b31c441d47fc2cb3dcb87e0573f519dd9
Showing with 17 additions and 5 deletions.
  1. +4 −4 src/nvim/mouse.c
  2. +13 −1 test/functional/ui/fold_spec.lua
@@ -109,12 +109,12 @@ int jump_to_mouse(int flags,
if (flags & MOUSE_SETPOS)
goto retnomove; // ugly goto...

// Remember the character under the mouse, it might be a '-' or '+' in the
// fold column. NB: only works for ASCII chars!
// Remember the character under the mouse, might be one of foldclose or
// foldopen fillchars in the fold column.
if (row >= 0 && row < Rows && col >= 0 && col <= Columns
&& default_grid.chars != NULL) {
mouse_char = default_grid.chars[default_grid.line_offset[row]
+ (unsigned)col][0];
mouse_char = utf_ptr2char(default_grid.chars[default_grid.line_offset[row]
+ (unsigned)col]);
} else {
mouse_char = ' ';
}
@@ -96,8 +96,20 @@ describe("folded lines", function()
{1: ~}|
:set rightleft |
]]}
end)

feed_command("set norightleft")
meths.input_mouse('left', 'press', '', 0, 0, 1)
screen:expect{grid=[[
{7:▾▸}{5:^+--- 5 lines: aa··························}|
{7:│ }ff |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
:set norightleft |
]]}
end)

it("works with multibyte text", function()
-- Currently the only allowed value of 'maxcombine'

0 comments on commit bb331a9

Please sign in to comment.
You can’t perform that action at this time.