aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2021-12-26 19:11:51 +0100
committerGitHub <noreply@github.com>2021-12-26 19:11:51 +0100
commit99526dc9b3355cb99cd1b82e47a36db71db4a669 (patch)
treec02390cf72a6a60626919395c758f57c820557c8
parent457a8ca7a7110b0e8237d8ad75f3f7ee4f4fe539 (diff)
parentc96f7e29dc69976c2f5efa0a59710ef8416bb982 (diff)
downloadrneovim-99526dc9b3355cb99cd1b82e47a36db71db4a669.tar.gz
rneovim-99526dc9b3355cb99cd1b82e47a36db71db4a669.tar.bz2
rneovim-99526dc9b3355cb99cd1b82e47a36db71db4a669.zip
Merge pull request #16596 from dm1try/do_not_leave_terminal_mode_after_mouse_activation
do not leave Terminal mode after entering to it using a mouse
-rw-r--r--src/nvim/terminal.c6
-rw-r--r--test/functional/terminal/mouse_spec.lua6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index d97c24dcf7..6add541ad4 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -1295,6 +1295,12 @@ static bool send_mouse_event(Terminal *term, int c)
return mouse_win == curwin;
}
+ // ignore left release action if it was not proccessed above
+ // to prevent leaving Terminal mode after entering to it using a mouse
+ if (c == K_LEFTRELEASE && mouse_win->w_buffer->terminal == term) {
+ return false;
+ }
+
end:
ins_char_typebuf(c);
return true;
diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua
index 3d8441b93c..833ded9479 100644
--- a/test/functional/terminal/mouse_spec.lua
+++ b/test/functional/terminal/mouse_spec.lua
@@ -45,6 +45,12 @@ describe(':terminal mouse', function()
eq('nt', eval('mode(1)'))
end)
+ it('does not leave terminal mode on left-release', function()
+ if helpers.pending_win32(pending) then return end
+ feed('<LeftRelease>')
+ eq('t', eval('mode(1)'))
+ end)
+
describe('with mouse events enabled by the program', function()
before_each(function()
thelpers.enable_mouse()