diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2018-09-11 09:03:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-11 09:03:09 +0200 |
commit | d6b3c09129dee687b33db719be5bb3e2b51deccc (patch) | |
tree | b22b43c8a0f117a6cf6b61558c83fe3131f791f0 /src/nvim/edit.c | |
parent | 036051b218760c6c8ff70b2ff347916acab993ff (diff) | |
parent | 329cfc3303cffd5c9aad7b2ad7f4323354d68b0d (diff) | |
download | rneovim-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/edit.c')
-rw-r--r-- | src/nvim/edit.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index a20661bb16..e42fe4efb0 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2131,11 +2131,7 @@ int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int char_u *p = IObuff; i = 0; while (i < actual_len && (p - IObuff + 6) < IOSIZE) { - if (has_mbyte) { - p += (*mb_char2bytes)(wca[i++], p); - } else { - *(p++) = wca[i++]; - } + p += utf_char2bytes(wca[i++], p); } *p = NUL; } @@ -3084,10 +3080,10 @@ static void ins_compl_addleader(int c) if (stop_arrow() == FAIL) { return; } - if (has_mbyte && (cc = (*mb_char2len)(c)) > 1) { + if ((cc = utf_char2len(c)) > 1) { char_u buf[MB_MAXBYTES + 1]; - (*mb_char2bytes)(c, buf); + utf_char2bytes(c, buf); buf[cc] = NUL; ins_char_bytes(buf, cc); } else { @@ -5334,10 +5330,10 @@ insertchar ( } else { int cc; - if (has_mbyte && (cc = (*mb_char2len)(c)) > 1) { + if ((cc = utf_char2len(c)) > 1) { char_u buf[MB_MAXBYTES + 1]; - (*mb_char2bytes)(c, buf); + utf_char2bytes(c, buf); buf[cc] = NUL; ins_char_bytes(buf, cc); AppendCharToRedobuff(c); @@ -8660,12 +8656,7 @@ static char_u *do_insert_char_pre(int c) if (!has_event(EVENT_INSERTCHARPRE)) { return NULL; } - if (has_mbyte) { - buf[(*mb_char2bytes)(c, (char_u *) buf)] = NUL; - } else { - buf[0] = c; - buf[1] = NUL; - } + buf[utf_char2bytes(c, (char_u *)buf)] = NUL; // Lock the text to avoid weird things from happening. textlock++; |