From 2875ad865b5c48103642a65728d984ceee75ed65 Mon Sep 17 00:00:00 2001 From: Rui Abreu Ferreira Date: Tue, 8 Jul 2014 15:16:30 +0100 Subject: Add API vim_replace_termcodes - Add API function to call replace_termcodes --- src/nvim/api/vim.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index a325459887..a2c50b4c81 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -84,6 +84,24 @@ void vim_feedkeys(String keys, String mode) typebuf_was_filled = true; } +/// Replace any terminal codes with the internal representation +/// +/// @see replace_termcodes +/// @see cpoptions +String vim_replace_termcodes(String str, Boolean from_part, Boolean do_lt, + Boolean special) +{ + if (str.size == 0) { + // Empty string + return str; + } + + char *ptr = NULL; + replace_termcodes((char_u *)str.data, (char_u **)&ptr, + from_part, do_lt, special); + return cstr_as_string(ptr); +} + /// Evaluates the expression str using the vim internal expression /// evaluator (see |expression|). /// Dictionaries and lists are recursively expanded. -- cgit