diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-18 08:38:15 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-18 12:51:35 -0300 |
commit | 42112e04a999c0f289939fce3142ef2c2517110a (patch) | |
tree | 5f2a1dd7395461be1bc6df7aa259fa8dd63008d3 /src/nvim/mbyte.c | |
parent | 68de5d79a243fecc9ef256d9d0356f8541aa3821 (diff) | |
download | rneovim-42112e04a999c0f289939fce3142ef2c2517110a.tar.gz rneovim-42112e04a999c0f289939fce3142ef2c2517110a.tar.bz2 rneovim-42112e04a999c0f289939fce3142ef2c2517110a.zip |
ui: Refactor input buffer handling
All input buffer code was moved to os/input.c, and `inbuf` is now a `RBuffer`
instance(which abstracts static buffer manipulation).
Diffstat (limited to 'src/nvim/mbyte.c')
-rw-r--r-- | src/nvim/mbyte.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 7ba4409180..cb33c2e666 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -3803,50 +3803,6 @@ int convert_setup_ext(vimconv_T *vcp, char_u *from, bool from_unicode_is_utf8, return OK; } -#if defined(FEAT_GUI) || defined(WIN3264) || defined(PROTO) -/* - * Do conversion on typed input characters in-place. - * The input and output are not NUL terminated! - * Returns the length after conversion. - */ -int convert_input(char_u *ptr, int len, int maxlen) -{ - return convert_input_safe(ptr, len, maxlen, NULL, NULL); -} -#endif - -/* - * Like convert_input(), but when there is an incomplete byte sequence at the - * end return that as an allocated string in "restp" and set "*restlenp" to - * the length. If "restp" is NULL it is not used. - */ -int convert_input_safe(char_u *ptr, int len, int maxlen, char_u **restp, - int *restlenp) -{ - char_u *d; - int dlen = len; - int unconvertlen = 0; - - d = string_convert_ext(&input_conv, ptr, &dlen, - restp == NULL ? NULL : &unconvertlen); - if (d != NULL) { - if (dlen <= maxlen) { - if (unconvertlen > 0) { - /* Move the unconverted characters to allocated memory. */ - *restp = xmalloc(unconvertlen); - memmove(*restp, ptr + len - unconvertlen, unconvertlen); - *restlenp = unconvertlen; - } - memmove(ptr, d, dlen); - } else - /* result is too long, keep the unconverted text (the caller must - * have done something wrong!) */ - dlen = len; - free(d); - } - return dlen; -} - /* * Convert text "ptr[*lenp]" according to "vcp". * Returns the result in allocated memory and sets "*lenp". |