diff --git a/src/nvim/dialog.c b/src/nvim/dialog.c index 04d9b515b2..796f42b127 100644 --- a/src/nvim/dialog.c +++ b/src/nvim/dialog.c @@ -17,6 +17,7 @@ #include "nvim/memory.h" #include "nvim/message.h" #include "nvim/mouse.h" +#include "nvim/option_vars.h" #include "nvim/os/input.h" #include "nvim/state_defs.h" #include "nvim/ui.h" @@ -81,7 +82,7 @@ int prompt_for_input(char *prompt, int hl_id, bool one_key, bool *mouse_used) char *kmsg = keep_msg ? xstrdup(keep_msg) : NULL; if (prompt == NULL) { - if (mouse_used != NULL) { + if (mouse_used != NULL && ui_mouse_has(kMouseCommand)) { prompt = _("Type number and or click with the mouse (q or empty cancels): "); } else { prompt = _("Type number and (q or empty cancels): "); diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua index f9064e4b74..140e4c0212 100644 --- a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua +++ b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua @@ -163,7 +163,7 @@ describe("preserve and (R)ecover with custom 'directory'", function() content = { { '' } }, pos = 0, -- Default vim.ui.select prompt. - prompt = 'Type number and or click with the mouse (q or empty cancels): ', + prompt = 'Type number and (q or empty cancels): ', }, }, condition = function() @@ -189,7 +189,7 @@ describe("preserve and (R)ecover with custom 'directory'", function() '\n1:.*%.swo', '\n2:.*%.swp', 'host name:', - vim.pesc('Type number and or click with the mouse (q or empty cancels): ^'), + vim.pesc('Type number and (q or empty cancels): ^'), }, none = vim.pesc('{18:^@}'), }) diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index aeabb4ad88..6d7a5c2028 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -1007,7 +1007,7 @@ describe('cmdline redraw', function() {3: }| foo | bar | - Type number and or click with the mouse (q or empty cancels): ^ | + Type number and (q or empty cancels): ^ | ]]) command('redraw') screen:expect_unchanged() diff --git a/test/functional/ui/messages2_spec.lua b/test/functional/ui/messages2_spec.lua index 1e6e0dfb1b..ea21a600a4 100644 --- a/test/functional/ui/messages2_spec.lua +++ b/test/functional/ui/messages2_spec.lua @@ -654,7 +654,7 @@ describe('messages2', function() 4 | 5 | 6 [+93] | - Type number and or click with the mouse (q or empty cancels): ^ | + Type number and (q or empty cancels): ^ | ]] feed(':call inputlist(range(100))') screen:expect(top) @@ -670,7 +670,7 @@ describe('messages2', function() 5 | 6 | 7 [+92] | - Type number and or click with the mouse (q or empty cancels): ^ | + Type number and (q or empty cancels): ^ | ]]) feed('') screen:expect(top) @@ -686,7 +686,7 @@ describe('messages2', function() 9 | 10 | 11 [+88] | - Type number and or click with the mouse (q or empty cancels): ^ | + Type number and (q or empty cancels): ^ | ]]) feed('') screen:expect(top) @@ -702,7 +702,7 @@ describe('messages2', function() 97 | 98 | 99 | - Type number and or click with the mouse (q or empty cancels): ^ | + Type number and (q or empty cancels): ^ | ]]) -- No scrolling beyond end of buffer #36114 feed('') diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index b8cc3115d5..44f2e50caf 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -407,7 +407,7 @@ describe('ui/ext_messages', function() content = { { '' } }, pos = 0, -- Default vim.ui.select uses this prompt. - prompt = 'Type number and or click with the mouse (q or empty cancels): ', + prompt = 'Type number and (q or empty cancels): ', }, }, -- Message depends on runtimepath, only test the static text... @@ -1292,7 +1292,7 @@ stack traceback: { content = { { '' } }, pos = 0, - prompt = 'Type number and or click with the mouse (q or empty cancels): ', + prompt = 'Type number and (q or empty cancels): ', }, }, messages = { @@ -1313,7 +1313,7 @@ stack traceback: { content = { { '1' } }, pos = 1, - prompt = 'Type number and or click with the mouse (q or empty cancels): ', + prompt = 'Type number and (q or empty cancels): ', }, }, }) @@ -1334,7 +1334,7 @@ stack traceback: { content = { { '' } }, pos = 0, - prompt = 'Type number and or click with the mouse (q or empty cancels): ', + prompt = 'Type number and (q or empty cancels): ', }, }, messages = { { content = { { 'input0\ninput1' } }, kind = 'confirm' } }, diff --git a/test/functional/vimscript/input_spec.lua b/test/functional/vimscript/input_spec.lua index f490733a7e..0491242876 100644 --- a/test/functional/vimscript/input_spec.lua +++ b/test/functional/vimscript/input_spec.lua @@ -427,6 +427,19 @@ describe('inputdialog()', function() end) end) +describe('inputlist()', function() + it("only offers the mouse when 'mouse' applies to cmdline mode", function() + screen:try_resize(75, 5) + feed(':call inputlist(["foo", "bar"])') + screen:expect({ any = vim.pesc('Type number and (q or empty cancels): ') }) + feed('q') + command('set mouse=a') + feed(':call inputlist(["foo", "bar"])') + screen:expect({ any = vim.pesc('Type number and or click with the mouse') }) + feed('q') + end) +end) + describe('confirm()', function() it('works', function() api.nvim_set_option_value('more', false, {}) -- Avoid hit-enter prompt