mirror of
https://github.com/vim/vim.git
synced 2025-11-14 23:04:02 -05:00
updated for version 7.4.057
Problem: byteidx() does not work for composing characters. Solution: Add byteidxcomp().
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
Test for multi-byte text formatting.
|
||||
Also test, that 'mps' with multibyte chars works.
|
||||
And test "ra" on multi-byte characters.
|
||||
Also test byteidx() and byteidxcomp()
|
||||
|
||||
STARTTEST
|
||||
:so mbyte.vim
|
||||
@@ -153,6 +154,21 @@ ra test
|
||||
abba
|
||||
aab
|
||||
|
||||
STARTTEST
|
||||
:let a = '.é.' " one char of two bytes
|
||||
:let b = '.é.' " normal e with composing char
|
||||
/^byteidx
|
||||
:put =string([byteidx(a, 0), byteidx(a, 1), byteidx(a, 2), byteidx(a, 3), byteidx(a, 4)])
|
||||
:put =string([byteidx(b, 0), byteidx(b, 1), byteidx(b, 2), byteidx(b, 3), byteidx(b, 4)])
|
||||
/^byteidxcomp
|
||||
:put =string([byteidxcomp(a, 0), byteidxcomp(a, 1), byteidxcomp(a, 2), byteidxcomp(a, 3), byteidxcomp(a, 4)])
|
||||
:let b = '.é.'
|
||||
:put =string([byteidxcomp(b, 0), byteidxcomp(b, 1), byteidxcomp(b, 2), byteidxcomp(b, 3), byteidxcomp(b, 4), byteidxcomp(b, 5)])
|
||||
ENDTEST
|
||||
|
||||
byteidx
|
||||
byteidxcomp
|
||||
|
||||
STARTTEST
|
||||
:g/^STARTTEST/.,/^ENDTEST/d
|
||||
:1;/^Results/,$wq! test.out
|
||||
|
||||
@@ -149,3 +149,11 @@ ra test
|
||||
aaaa
|
||||
aaa
|
||||
|
||||
|
||||
byteidx
|
||||
[0, 1, 3, 4, -1]
|
||||
[0, 1, 4, 5, -1]
|
||||
byteidxcomp
|
||||
[0, 1, 3, 4, -1]
|
||||
[0, 1, 2, 4, 5, -1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user