aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/message.c
diff options
context:
space:
mode:
authorZviRackover <zvirack@gmail.com>2018-07-01 22:58:42 +0300
committerZviRackover <zvirack@gmail.com>2018-08-06 22:27:10 +0300
commit5cecd7a93aba83cd477519974fc33fadbdcfdc87 (patch)
tree3d052800def8498c4d26887b881f99e40bb38a46 /src/nvim/message.c
parent071aab51488e03a0e09a0a60aec6c0abc0277279 (diff)
downloadrneovim-5cecd7a93aba83cd477519974fc33fadbdcfdc87.tar.gz
rneovim-5cecd7a93aba83cd477519974fc33fadbdcfdc87.tar.bz2
rneovim-5cecd7a93aba83cd477519974fc33fadbdcfdc87.zip
style: fixing minor issues noted in code review.
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r--src/nvim/message.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index ddbc17439b..947cd0735e 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -2866,15 +2866,12 @@ do_dialog (
// Make the character lowercase, as chars in "hotkeys" are.
c = mb_tolower(c);
retval = 1;
- for (i = 0; hotkeys[i]; ++i) {
- if (has_mbyte) {
- if (utf_ptr2char(hotkeys + i) == c) {
- break;
- }
- i += (*mb_ptr2len)(hotkeys + i) - 1;
- } else if (hotkeys[i] == c)
+ for (i = 0; hotkeys[i]; i++) {
+ if (utf_ptr2char(hotkeys + i) == c) {
break;
- ++retval;
+ }
+ i += utfc_ptr2len(hotkeys + i) - 1;
+ retval++;
}
if (hotkeys[i])
break;
@@ -2906,25 +2903,13 @@ copy_char (
int lowercase /* make character lower case */
)
{
- int len;
- int c;
-
- if (has_mbyte) {
- if (lowercase) {
- c = mb_tolower(utf_ptr2char(from));
- return (*mb_char2bytes)(c, to);
- } else {
- len = (*mb_ptr2len)(from);
- memmove(to, from, (size_t)len);
- return len;
- }
- } else {
- if (lowercase)
- *to = (char_u)TOLOWER_LOC(*from);
- else
- *to = *from;
- return 1;
+ if (lowercase) {
+ int c = mb_tolower(utf_ptr2char(from));
+ return utf_char2bytes(c, to);
}
+ int len = utfc_ptr2len(from);
+ memmove(to, from, (size_t)len);
+ return len;
}
#define HAS_HOTKEY_LEN 30