diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-05-20 22:20:21 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-05-20 22:20:32 +0200 |
commit | bdd73fc07ff8bcf9502f9c6a980a278b9e7b8f27 (patch) | |
tree | 615c16ee4276f53f54f8d99352ec7e3386339eff | |
parent | bfb9cf1fc3fb377e4ca1430e95435fe7ad06282b (diff) | |
download | rneovim-bdd73fc07ff8bcf9502f9c6a980a278b9e7b8f27.tar.gz rneovim-bdd73fc07ff8bcf9502f9c6a980a278b9e7b8f27.tar.bz2 rneovim-bdd73fc07ff8bcf9502f9c6a980a278b9e7b8f27.zip |
api/nvim_replace_termcodes: Document keycodes behavior
-rw-r--r-- | src/nvim/api/vim.c | 3 | ||||
-rw-r--r-- | test/functional/api/vim_spec.lua | 5 |
2 files changed, 7 insertions, 1 deletions
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 (<CR>, <Esc>, ...) 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() '<LeftMouse>', true, true, true)) end) + it('converts keycodes', function() + eq('\nx\27x\rx<x', helpers.nvim('replace_termcodes', + '<NL>x<Esc>x<CR>x<lt>x', 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. |