aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-06-13 18:21:25 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2018-06-14 14:00:09 +0200
commit5442f0b6221946e482dec2cb82576f0ba38900fe (patch)
tree8a977ba24079aabb5a6babacd314f20d95c40cf5 /src
parenta7bb63c55dacfa822e1a24d041771d9e8d83a980 (diff)
downloadrneovim-5442f0b6221946e482dec2cb82576f0ba38900fe.tar.gz
rneovim-5442f0b6221946e482dec2cb82576f0ba38900fe.tar.bz2
rneovim-5442f0b6221946e482dec2cb82576f0ba38900fe.zip
fillchars: make checks more strict and improve tests
Diffstat (limited to 'src')
-rw-r--r--src/nvim/option.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 3c1a70e90d..e65798e57a 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3438,16 +3438,20 @@ static char_u *set_chars_option(char_u **varp)
&& p[len] == ':'
&& p[len + 1] != NUL) {
s = p + len + 1;
- c1 = mb_ptr2char_adv((const char_u **)&s);
- if (mb_char2cells(c1) > 1) {
+
+ // TODO(bfredl): use schar_T representation and utfc_ptr2len
+ int c1len = utf_ptr2len(s);
+ c1 = mb_cptr2char_adv((const char_u **)&s);
+ if (mb_char2cells(c1) > 1 || (c1len == 1 && c1 > 127)) {
continue;
}
if (tab[i].cp == &lcs_tab2) {
if (*s == NUL) {
continue;
}
- c2 = mb_ptr2char_adv((const char_u **)&s);
- if (mb_char2cells(c2) > 1) {
+ int c2len = utf_ptr2len(s);
+ c2 = mb_cptr2char_adv((const char_u **)&s);
+ if (mb_char2cells(c2) > 1 || (c2len == 1 && c2 > 127)) {
continue;
}
}