fix(messages): inputlist() offers the mouse when it cannot be used (#41280)

Problem:
`inputlist()` advertises "click with the mouse" purely because it
implements click selection, so under the default `'mouse'` of "nvi" it
offers a click that command-line mode never receives.

Solution:
Only offer the mouse when `'mouse'` covers command-line mode, the same
condition `:help inputlist()` already documents.
This commit is contained in:
Barrett Ruth
2026-08-13 18:38:39 -05:00
committed by GitHub
parent faf8345eef
commit fc3f71fb7d
6 changed files with 26 additions and 12 deletions

View File

@@ -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"])<CR>')
screen:expect({ any = vim.pesc('Type number and <Enter> (q or empty cancels): ') })
feed('q')
command('set mouse=a')
feed(':call inputlist(["foo", "bar"])<CR>')
screen:expect({ any = vim.pesc('Type number and <Enter> 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