mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
fix(lua): correct return value for on_key with no arguments (#25911)
This commit is contained in:
@ -650,7 +650,7 @@ local on_key_cbs = {}
|
|||||||
---if on_key() is called without arguments.
|
---if on_key() is called without arguments.
|
||||||
function vim.on_key(fn, ns_id)
|
function vim.on_key(fn, ns_id)
|
||||||
if fn == nil and ns_id == nil then
|
if fn == nil and ns_id == nil then
|
||||||
return #on_key_cbs
|
return vim.tbl_count(on_key_cbs)
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.validate({
|
vim.validate({
|
||||||
|
@ -2438,6 +2438,12 @@ describe('lua stdlib', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('allows removing on_key listeners', function()
|
it('allows removing on_key listeners', function()
|
||||||
|
-- Create some unused namespaces
|
||||||
|
meths.create_namespace('unused1')
|
||||||
|
meths.create_namespace('unused2')
|
||||||
|
meths.create_namespace('unused3')
|
||||||
|
meths.create_namespace('unused4')
|
||||||
|
|
||||||
insert([[hello world]])
|
insert([[hello world]])
|
||||||
|
|
||||||
exec_lua [[
|
exec_lua [[
|
||||||
|
Reference in New Issue
Block a user