diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 1fedaf30ef..53e5f71fd4 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -135,7 +135,8 @@ Integer nvim_input(String keys) return (Integer)input_enqueue(keys); } -/// Replaces any terminal codes with the internal representation +/// Replaces terminal codes and key codes (, , ...) in a string with +/// the internal representation. /// /// @see replace_termcodes /// @see cpoptions diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 61ec6ea829..161682b973 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -368,6 +368,11 @@ describe('api', function() '', true, true, true)) end) + it('converts keycodes', function() + eq('\nx\27x\rxxxxx', true, true, true)) + end) + it('does not crash when transforming an empty string', function() -- Actually does not test anything, because current code will use NULL for -- an empty string.