api/nvim_replace_termcodes: Document keycodes behavior

This commit is contained in:
Justin M. Keyes 2017-05-20 22:20:21 +02:00
parent bfb9cf1fc3
commit bdd73fc07f
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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.