diff options
| author | Björn Linse <bjorn.linse@gmail.com> | 2018-06-14 18:00:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-14 18:00:59 +0200 |
| commit | c46997aa8744f88e9886022dab703157c101cff7 (patch) | |
| tree | ea9dafd38264c3e8b3c0e8c1449f13d7baabd79b /src/nvim/option.c | |
| parent | f27a665e0515c280e1fa6c999f29921eb882c6b2 (diff) | |
| parent | 5442f0b6221946e482dec2cb82576f0ba38900fe (diff) | |
| download | rneovim-c46997aa8744f88e9886022dab703157c101cff7.tar.gz rneovim-c46997aa8744f88e9886022dab703157c101cff7.tar.bz2 rneovim-c46997aa8744f88e9886022dab703157c101cff7.zip | |
Merge pull request #8546 from bfredl/eob
Add fillchar for EndOfBuffer and check for invalid UTF-8
Diffstat (limited to 'src/nvim/option.c')
| -rw-r--r-- | src/nvim/option.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index a7ee0ef28b..e65798e57a 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -3386,6 +3386,7 @@ static char_u *set_chars_option(char_u **varp) { &fill_fold, "fold" , 183 }, // · { &fill_diff, "diff" , '-' }, { &fill_msgsep, "msgsep", ' ' }, + { &fill_eob, "eob", '~' }, }; static struct charstab lcstab[] = { { &lcs_eol, "eol", NUL }, @@ -3437,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; } } |