diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-01-01 16:30:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-01 16:30:21 +0100 |
commit | 57ce8b56488a781088cb503f0da723f59e2f9554 (patch) | |
tree | 9984fb6deafbf8639d3a19ec2743426044cd8c52 /src/nvim/mbyte.c | |
parent | 3d3545bbc17627a46ee85ce8e85bdd75523c3982 (diff) | |
parent | 13e2e2207354d940921dd5a95e322715b74c06a4 (diff) | |
download | rneovim-57ce8b56488a781088cb503f0da723f59e2f9554.tar.gz rneovim-57ce8b56488a781088cb503f0da723f59e2f9554.tar.bz2 rneovim-57ce8b56488a781088cb503f0da723f59e2f9554.zip |
Merge #5855 from lonerover/vim-7.4.2019
vim-patch:7.4.2019,7.4.2028
Diffstat (limited to 'src/nvim/mbyte.c')
-rw-r--r-- | src/nvim/mbyte.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 2ecd86974e..ec4969d4f6 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -1315,6 +1315,10 @@ static int utf_convert(int a, const convertStruct *const table, size_t n_items) */ int utf_fold(int a) { + if (a < 0x80) { + // be fast for ASCII + return a >= 0x41 && a <= 0x5a ? a + 32 : a; + } return utf_convert(a, foldCase, ARRAY_SIZE(foldCase)); } @@ -2105,13 +2109,14 @@ char_u * enc_locale(void) } else s = p + 1; } - for (i = 0; s[i] != NUL && i < (int)sizeof(buf) - 1; ++i) { - if (s[i] == '_' || s[i] == '-') + for (i = 0; i < (int)sizeof(buf) - 1 && s[i] != NUL; i++) { + if (s[i] == '_' || s[i] == '-') { buf[i] = '-'; - else if (isalnum((int)s[i])) + } else if (isalnum((int)s[i])) { buf[i] = TOLOWER_ASC(s[i]); - else + } else { break; + } } buf[i] = NUL; |