From a04c73cc17f5fd9643fcf9de28ef957547f4a424 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 20 Nov 2025 12:33:02 +0800 Subject: fix(input): discard following keys when discarding /K_LUA (#36498) Technically the current behavior does match documentation. However, the keys following /K_LUA aren't normally received by vim.on_key() callbacks either, so it does makes sense to discard them along with the preceding key. One may also argue that vim.on_key() callbacks should instead receive the following keys together with the /K_LUA, but doing that may cause some performance problems, and even in that case the keys should still be discarded together. --- runtime/lua/vim/_editor.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/_editor.lua') diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 284a22657b..ac88c32bc2 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -604,7 +604,8 @@ local on_key_cbs = {} --- @type table --- are applied, and {typed} is the key(s) before mappings are applied. --- {typed} may be empty if {key} is produced by non-typed key(s) or by the --- same typed key(s) that produced a previous {key}. ---- If {fn} returns an empty string, {key} is discarded/ignored. +--- If {fn} returns an empty string, {key} is discarded/ignored, and if {key} +--- is [] then the "[]…[]" sequence is discarded as a whole. --- When {fn} is `nil`, the callback associated with namespace {ns_id} is removed. ---@param ns_id integer? Namespace ID. If nil or 0, generates and returns a --- new |nvim_create_namespace()| id. -- cgit v1.3-3-g829e