Mercurial > vim
diff src/testdir/test_utf8.vim @ 31782:a19ef442c77a v9.0.1223
patch 9.0.1223: cannot use setcellwidths() below 0x100
Commit: https://github.com/vim/vim/commit/7193323b7796c05573f3aa89d422e848feb3a8dc
Author: K.Takata <kentkt@csc.jp>
Date: Fri Jan 20 16:00:55 2023 +0000
patch 9.0.1223: cannot use setcellwidths() below 0x100
Problem: Cannot use setcellwidths() below 0x100.
Solution: Also accept characters between 0x80 and 0x100. (Ken Takata,
closes #11834)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 20 Jan 2023 21:01:44 +0100 |
parents | f348559ce426 |
children | dbec60b8c253 |
line wrap: on
line diff
--- a/src/testdir/test_utf8.vim +++ b/src/testdir/test_utf8.vim @@ -167,6 +167,39 @@ func Test_setcellwidths() call assert_equal(2, strwidth("\u1339")) call assert_equal(1, strwidth("\u133a")) + for aw in ['single', 'double'] + exe 'set ambiwidth=' . aw + " Handle \u0080 to \u009F as control chars even on MS-Windows. + set isprint=@,161-255 + + call setcellwidths([]) + " Control chars + call assert_equal(4, strwidth("\u0081")) + call assert_equal(6, strwidth("\uFEFF")) + " Ambiguous width chars + call assert_equal((aw == 'single') ? 1 : 2, strwidth("\u00A1")) + call assert_equal((aw == 'single') ? 1 : 2, strwidth("\u2010")) + + call setcellwidths([[0x81, 0x81, 1], [0xA1, 0xA1, 1], + \ [0x2010, 0x2010, 1], [0xFEFF, 0xFEFF, 1]]) + " Control chars + call assert_equal(4, strwidth("\u0081")) + call assert_equal(6, strwidth("\uFEFF")) + " Ambiguous width chars + call assert_equal(1, strwidth("\u00A1")) + call assert_equal(1, strwidth("\u2010")) + + call setcellwidths([[0x81, 0x81, 2], [0xA1, 0xA1, 2], + \ [0x2010, 0x2010, 2], [0xFEFF, 0xFEFF, 2]]) + " Control chars + call assert_equal(4, strwidth("\u0081")) + call assert_equal(6, strwidth("\uFEFF")) + " Ambiguous width chars + call assert_equal(2, strwidth("\u00A1")) + call assert_equal(2, strwidth("\u2010")) + endfor + set ambiwidth& isprint& + call setcellwidths([]) call assert_fails('call setcellwidths(1)', 'E1211:')