aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/keymap.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-09-11 09:03:09 +0200
committerGitHub <noreply@github.com>2018-09-11 09:03:09 +0200
commitd6b3c09129dee687b33db719be5bb3e2b51deccc (patch)
treeb22b43c8a0f117a6cf6b61558c83fe3131f791f0 /src/nvim/keymap.c
parent036051b218760c6c8ff70b2ff347916acab993ff (diff)
parent329cfc3303cffd5c9aad7b2ad7f4323354d68b0d (diff)
downloadrneovim-d6b3c09129dee687b33db719be5bb3e2b51deccc.tar.gz
rneovim-d6b3c09129dee687b33db719be5bb3e2b51deccc.tar.bz2
rneovim-d6b3c09129dee687b33db719be5bb3e2b51deccc.zip
Merge pull request #8945 from ZviRackover/fix-7401-step5
mbyte: remove mb_char2bytes
Diffstat (limited to 'src/nvim/keymap.c')
-rw-r--r--src/nvim/keymap.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c
index 3cc74c0044..ade5487ec8 100644
--- a/src/nvim/keymap.c
+++ b/src/nvim/keymap.c
@@ -462,14 +462,13 @@ char_u *get_special_key_name(int c, int modifiers)
string[idx++] = '_';
string[idx++] = (char_u)KEY2TERMCAP0(c);
string[idx++] = KEY2TERMCAP1(c);
- }
- /* Not a special key, only modifiers, output directly */
- else {
- if (has_mbyte && (*mb_char2len)(c) > 1)
- idx += (*mb_char2bytes)(c, string + idx);
- else if (vim_isprintc(c))
+ } else {
+ // Not a special key, only modifiers, output directly.
+ if (utf_char2len(c) > 1) {
+ idx += utf_char2bytes(c, string + idx);
+ } else if (vim_isprintc(c)) {
string[idx++] = (char_u)c;
- else {
+ } else {
s = transchar(c);
while (*s)
string[idx++] = *s++;
@@ -524,14 +523,12 @@ unsigned int trans_special(const char_u **srcp, const size_t src_len,
dst[dlen++] = K_SPECIAL;
dst[dlen++] = (char_u)KEY2TERMCAP0(key);
dst[dlen++] = KEY2TERMCAP1(key);
- } else if (has_mbyte && !keycode) {
- dlen += (unsigned int)(*mb_char2bytes)(key, dst + dlen);
- } else if (keycode) {
+ } else if (!keycode) {
+ dlen += (unsigned int)utf_char2bytes(key, dst + dlen);
+ } else {
char_u *after = add_char2buf(key, dst + dlen);
assert(after >= dst && (uintmax_t)(after - dst) <= UINT_MAX);
dlen = (unsigned int)(after - dst);
- } else {
- dst[dlen++] = (char_u)key;
}
return dlen;