aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-01-23 19:40:59 +0100
committerGitHub <noreply@github.com>2022-01-23 19:40:59 +0100
commitf20bd439df2c0f487ccfe2460ebceb05b5257920 (patch)
tree250988159dc428e5dbf8f0d3f6a28db03ed604bf /test/functional/terminal
parent4ba7fa1700ead8a53d73fea7fc17a545f9b4588d (diff)
parent0efe1ec6b3a869cdfceb2ab98b230b52374a17ae (diff)
downloadrneovim-f20bd439df2c0f487ccfe2460ebceb05b5257920.tar.gz
rneovim-f20bd439df2c0f487ccfe2460ebceb05b5257920.tar.bz2
rneovim-f20bd439df2c0f487ccfe2460ebceb05b5257920.zip
Merge pull request #17168 from zeertzjq/ins-char-typebuf-mods
fix(input): put modifiers back into typeahead buffer when needed
Diffstat (limited to 'test/functional/terminal')
-rw-r--r--test/functional/terminal/mouse_spec.lua30
1 files changed, 25 insertions, 5 deletions
diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua
index 780a0b9b5a..6e2c851df7 100644
--- a/test/functional/terminal/mouse_spec.lua
+++ b/test/functional/terminal/mouse_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers')
local clear, eq, eval = helpers.clear, helpers.eq, helpers.eval
-local feed, nvim = helpers.feed, helpers.nvim
+local feed, nvim, command = helpers.feed, helpers.nvim, helpers.command
local feed_data = thelpers.feed_data
describe(':terminal mouse', function()
@@ -10,9 +10,9 @@ describe(':terminal mouse', function()
before_each(function()
clear()
nvim('set_option', 'statusline', '==========')
- nvim('command', 'highlight StatusLine cterm=NONE')
- nvim('command', 'highlight StatusLineNC cterm=NONE')
- nvim('command', 'highlight VertSplit cterm=NONE')
+ command('highlight StatusLine cterm=NONE')
+ command('highlight StatusLineNC cterm=NONE')
+ command('highlight VertSplit cterm=NONE')
screen = thelpers.screen_setup()
local lines = {}
for i = 1, 30 do
@@ -38,6 +38,26 @@ describe(':terminal mouse', function()
eq('nt', eval('mode(1)'))
end)
+ it('will exit focus and trigger Normal mode mapping on mouse click', function()
+ command('let g:got_leftmouse = 0')
+ command('nnoremap <LeftMouse> <Cmd>let g:got_leftmouse = 1<CR>')
+ eq('t', eval('mode(1)'))
+ eq(0, eval('g:got_leftmouse'))
+ feed('<LeftMouse>')
+ eq('nt', eval('mode(1)'))
+ eq(1, eval('g:got_leftmouse'))
+ end)
+
+ it('will exit focus and trigger Normal mode mapping on mouse click with modifier', function()
+ command('let g:got_ctrl_leftmouse = 0')
+ command('nnoremap <C-LeftMouse> <Cmd>let g:got_ctrl_leftmouse = 1<CR>')
+ eq('t', eval('mode(1)'))
+ eq(0, eval('g:got_ctrl_leftmouse'))
+ feed('<C-LeftMouse>')
+ eq('nt', eval('mode(1)'))
+ eq(1, eval('g:got_ctrl_leftmouse'))
+ end)
+
it('will exit focus on <C-\\> + mouse-scroll', function()
eq('t', eval('mode(1)'))
feed('<C-\\>')
@@ -180,7 +200,7 @@ describe(':terminal mouse', function()
it('will forward mouse clicks to the program with the correct even if set nu', function()
if helpers.pending_win32(pending) then return end
- nvim('command', 'set number')
+ command('set number')
-- When the display area such as a number is clicked, it returns to the
-- normal mode.
feed('<LeftMouse><3,0>')