aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/getchar.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/getchar.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/getchar.c')
-rw-r--r--src/nvim/getchar.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index f13bede076..8f1e5bb6c1 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -315,7 +315,7 @@ static void add_char_buff(buffheader_T *buf, int c)
if (IS_SPECIAL(c)) {
len = 1;
} else {
- len = mb_char2bytes(c, bytes);
+ len = utf_char2bytes(c, bytes);
}
for (int i = 0; i < len; i++) {
@@ -978,7 +978,7 @@ void ins_char_typebuf(int c)
buf[2] = (char_u)K_THIRD(c);
buf[3] = NUL;
} else {
- buf[(*mb_char2bytes)(c, buf)] = NUL;
+ buf[utf_char2bytes(c, buf)] = NUL;
}
(void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent);
}
@@ -3655,16 +3655,14 @@ int check_abbr(int c, char_u *ptr, int col, int mincol)
tb[j++] = (char_u)K_SECOND(c);
tb[j++] = (char_u)K_THIRD(c);
} else {
- if (c < ABBR_OFF && (c < ' ' || c > '~'))
- tb[j++] = Ctrl_V; /* special char needs CTRL-V */
- if (has_mbyte) {
- /* if ABBR_OFF has been added, remove it here */
- if (c >= ABBR_OFF)
- c -= ABBR_OFF;
- j += (*mb_char2bytes)(c, tb + j);
- } else {
- tb[j++] = (char_u)c;
+ if (c < ABBR_OFF && (c < ' ' || c > '~')) {
+ tb[j++] = Ctrl_V; // special char needs CTRL-V
+ }
+ // if ABBR_OFF has been added, remove it here.
+ if (c >= ABBR_OFF) {
+ c -= ABBR_OFF;
}
+ j += utf_char2bytes(c, tb + j);
}
tb[j] = NUL;
/* insert the last typed char */