diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-09-24 22:28:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-24 22:28:41 +0800 |
commit | 8317b9199edc6936fec829f4908f9c74dc874ce4 (patch) | |
tree | 4b9976d636262a6a6d159f616c300ab2386b7f4f /test/functional/ui/mouse_spec.lua | |
parent | dfc6c973a34b1d16d6e1ae135aff587366aeb083 (diff) | |
download | rneovim-8317b9199edc6936fec829f4908f9c74dc874ce4.tar.gz rneovim-8317b9199edc6936fec829f4908f9c74dc874ce4.tar.bz2 rneovim-8317b9199edc6936fec829f4908f9c74dc874ce4.zip |
fix(input): use click number of last click for mouse drag (#20300)
Diffstat (limited to 'test/functional/ui/mouse_spec.lua')
-rw-r--r-- | test/functional/ui/mouse_spec.lua | 96 |
1 files changed, 90 insertions, 6 deletions
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index 8c5475ecce..cb8dfdb8e1 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -648,8 +648,10 @@ describe('ui/mouse/input', function() ]]} end) - it('two clicks will select the word and enter VISUAL', function() - feed('<LeftMouse><2,2><LeftMouse><2,2>') + it('two clicks will enter VISUAL and dragging selects words', function() + feed('<LeftMouse><2,2>') + feed('<LeftRelease><2,2>') + feed('<LeftMouse><2,2>') screen:expect([[ testing | mouse | @@ -657,10 +659,38 @@ describe('ui/mouse/input', function() {0:~ }| {2:-- VISUAL --} | ]]) + feed('<LeftDrag><0,1>') + screen:expect([[ + testing | + ^m{1:ouse} | + {1:support} and selection | + {0:~ }| + {2:-- VISUAL --} | + ]]) + feed('<LeftDrag><4,0>') + screen:expect([[ + ^t{1:esting} | + {1:mouse} | + {1:support} and selection | + {0:~ }| + {2:-- VISUAL --} | + ]]) + feed('<LeftDrag><14,2>') + screen:expect([[ + testing | + mouse | + {1:support and selectio}^n | + {0:~ }| + {2:-- VISUAL --} | + ]]) end) - it('three clicks will select the line and enter VISUAL LINE', function() - feed('<LeftMouse><2,2><LeftMouse><2,2><LeftMouse><2,2>') + it('three clicks will enter VISUAL LINE and dragging selects lines', function() + feed('<LeftMouse><2,2>') + feed('<LeftRelease><2,2>') + feed('<LeftMouse><2,2>') + feed('<LeftRelease><2,2>') + feed('<LeftMouse><2,2>') screen:expect([[ testing | mouse | @@ -668,10 +698,40 @@ describe('ui/mouse/input', function() {0:~ }| {2:-- VISUAL LINE --} | ]]) + feed('<LeftDrag><0,1>') + screen:expect([[ + testing | + ^m{1:ouse} | + {1:support and selection} | + {0:~ }| + {2:-- VISUAL LINE --} | + ]]) + feed('<LeftDrag><4,0>') + screen:expect([[ + {1:test}^i{1:ng} | + {1:mouse} | + {1:support and selection} | + {0:~ }| + {2:-- VISUAL LINE --} | + ]]) + feed('<LeftDrag><14,2>') + screen:expect([[ + testing | + mouse | + {1:support and se}^l{1:ection} | + {0:~ }| + {2:-- VISUAL LINE --} | + ]]) end) - it('four clicks will enter VISUAL BLOCK', function() - feed('<LeftMouse><2,2><LeftMouse><2,2><LeftMouse><2,2><LeftMouse><2,2>') + it('four clicks will enter VISUAL BLOCK and dragging selects blockwise', function() + feed('<LeftMouse><2,2>') + feed('<LeftRelease><2,2>') + feed('<LeftMouse><2,2>') + feed('<LeftRelease><2,2>') + feed('<LeftMouse><2,2>') + feed('<LeftRelease><2,2>') + feed('<LeftMouse><2,2>') screen:expect([[ testing | mouse | @@ -679,6 +739,30 @@ describe('ui/mouse/input', function() {0:~ }| {2:-- VISUAL BLOCK --} | ]]) + feed('<LeftDrag><0,1>') + screen:expect([[ + testing | + ^m{1:ou}se | + {1:sup}port and selection | + {0:~ }| + {2:-- VISUAL BLOCK --} | + ]]) + feed('<LeftDrag><4,0>') + screen:expect([[ + te{1:st}^ing | + mo{1:use} | + su{1:ppo}rt and selection | + {0:~ }| + {2:-- VISUAL BLOCK --} | + ]]) + feed('<LeftDrag><14,2>') + screen:expect([[ + testing | + mouse | + su{1:pport and se}^lection | + {0:~ }| + {2:-- VISUAL BLOCK --} | + ]]) end) it('right click extends visual selection to the clicked location', function() |