aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.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/ex_getln.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/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 31231fe725..c2559e051d 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -1762,14 +1762,9 @@ static int command_line_handle_key(CommandLineState *s)
if (IS_SPECIAL(s->c) || mod_mask != 0) {
put_on_cmdline(get_special_key_name(s->c, mod_mask), -1, true);
} else {
- if (has_mbyte) {
- s->j = (*mb_char2bytes)(s->c, IObuff);
- IObuff[s->j] = NUL; // exclude composing chars
- put_on_cmdline(IObuff, s->j, true);
- } else {
- IObuff[0] = s->c;
- put_on_cmdline(IObuff, 1, true);
- }
+ s->j = utf_char2bytes(s->c, IObuff);
+ IObuff[s->j] = NUL; // exclude composing chars
+ put_on_cmdline(IObuff, s->j, true);
}
return command_line_changed(s);
}
@@ -2372,16 +2367,11 @@ redraw:
if (IS_SPECIAL(c1)) {
c1 = '?';
}
- if (has_mbyte) {
- len = (*mb_char2bytes)(c1, (char_u *)line_ga.ga_data + line_ga.ga_len);
- } else {
- len = 1;
- ((char_u *)line_ga.ga_data)[line_ga.ga_len] = c1;
- }
- if (c1 == '\n')
+ len = utf_char2bytes(c1, (char_u *)line_ga.ga_data + line_ga.ga_len);
+ if (c1 == '\n') {
msg_putchar('\n');
- else if (c1 == TAB) {
- /* Don't use chartabsize(), 'ts' can be different */
+ } else if (c1 == TAB) {
+ // Don't use chartabsize(), 'ts' can be different.
do {
msg_putchar(' ');
} while (++vcol % 8);
@@ -2897,12 +2887,12 @@ static void draw_cmdline(int start, int len)
u8c = arabic_shape(u8c, NULL, &u8cc[0], pc, pc1, nc);
- newlen += (*mb_char2bytes)(u8c, arshape_buf + newlen);
+ newlen += utf_char2bytes(u8c, arshape_buf + newlen);
if (u8cc[0] != 0) {
- newlen += (*mb_char2bytes)(u8cc[0], arshape_buf + newlen);
- if (u8cc[1] != 0)
- newlen += (*mb_char2bytes)(u8cc[1],
- arshape_buf + newlen);
+ newlen += utf_char2bytes(u8cc[0], arshape_buf + newlen);
+ if (u8cc[1] != 0) {
+ newlen += utf_char2bytes(u8cc[1], arshape_buf + newlen);
+ }
}
} else {
prev_c = u8c;