diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-06-05 17:11:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-05 17:11:58 +0800 |
commit | a3fba5cafcf124946ea65a68fc1b9dfbeb197525 (patch) | |
tree | c59dbad3afe3b3eb9cc5dbc7857a5a14ce7243fb /test/functional/ui/fold_spec.lua | |
parent | 16561dac39490921715a9a8a14dab884659ffc3e (diff) | |
download | rneovim-a3fba5cafcf124946ea65a68fc1b9dfbeb197525.tar.gz rneovim-a3fba5cafcf124946ea65a68fc1b9dfbeb197525.tar.bz2 rneovim-a3fba5cafcf124946ea65a68fc1b9dfbeb197525.zip |
fix(mouse): handle folded lines with virt_lines attached to line above (#23912)
Diffstat (limited to 'test/functional/ui/fold_spec.lua')
-rw-r--r-- | test/functional/ui/fold_spec.lua | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 06668c0ba3..68a7c89b32 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -45,6 +45,7 @@ describe("folded lines", function() [13] = {foreground = Screen.colors.Red, background = Screen.colors.LightGrey}, [14] = {background = Screen.colors.Red}, [15] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.Red}, + [16] = {background = Screen.colors.LightGrey}, }) end) @@ -2029,6 +2030,17 @@ describe("folded lines", function() ]]) end + meths.input_mouse('left', 'press', '', multigrid and 2 or 0, 4, 0) + eq({ + column = 1, + line = 3, + screencol = 1, + screenrow = 5, + wincol = 1, + winid = 1000, + winrow = 5, + }, funcs.getmousepos()) + meths.buf_set_extmark(0, ns, 1, 0, { virt_lines = {{{"more virt_line below line 2", ""}}} }) feed('G<C-E>') if multigrid then @@ -2245,6 +2257,150 @@ describe("folded lines", function() | ]]) end + + feed('3<C-Y>') + if multigrid then + screen:expect([[ + ## grid 1 + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [3:---------------------------------------------]| + ## grid 2 + virt_line below line 2 | + more virt_line below line 2 | + {5:+-- 2 lines: line 3·························}| + ^line 5 | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + | + ]]) + else + screen:expect([[ + virt_line below line 2 | + more virt_line below line 2 | + {5:+-- 2 lines: line 3·························}| + ^line 5 | + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]) + end + + meths.input_mouse('left', 'press', '3', multigrid and 2 or 0, 3, 0) + if multigrid then + screen:expect([[ + ## grid 1 + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [3:---------------------------------------------]| + ## grid 2 + virt_line below line 2 | + more virt_line below line 2 | + {5:+-- 2 lines: line 3·························}| + ^l{16:ine 5} | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + {11:-- VISUAL LINE --} | + ]]) + else + screen:expect([[ + virt_line below line 2 | + more virt_line below line 2 | + {5:+-- 2 lines: line 3·························}| + ^l{16:ine 5} | + {1:~ }| + {1:~ }| + {1:~ }| + {11:-- VISUAL LINE --} | + ]]) + end + + meths.input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 0) + if multigrid then + screen:expect([[ + ## grid 1 + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [3:---------------------------------------------]| + ## grid 2 + more virt_line below line 2 | + {5:+-- 2 lines: line 3·························}| + ^l{16:ine 5} | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + {11:-- VISUAL LINE --} | + ]]) + else + screen:expect([[ + more virt_line below line 2 | + {5:+-- 2 lines: line 3·························}| + ^l{16:ine 5} | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {11:-- VISUAL LINE --} | + ]]) + end + + meths.input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 5) + if multigrid then + screen:expect([[ + ## grid 1 + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [3:---------------------------------------------]| + ## grid 2 + {5:+-- 2 lines: line 3·························}| + {16:line }^5 | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + {11:-- VISUAL LINE --} | + ]]) + else + screen:expect([[ + {5:+-- 2 lines: line 3·························}| + {16:line }^5 | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {11:-- VISUAL LINE --} | + ]]) + end end) it('Folded and Visual highlights are combined #19691', function() |