view src/testdir/test69.in @ 15062:3a94f7918980 v8.1.0542

patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account commit https://github.com/vim/vim/commit/f951416a8396a54bbbe21de1a8b16716428549f2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 22 03:08:29 2018 +0100 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account Problem: shiftwidth() does not take 'vartabstop' into account. Solution: Use the cursor position or a position explicitly passed. Also make >> and << work better with 'vartabstop'. (Christian Brabandt)
author Bram Moolenaar <Bram@vim.org>
date Thu, 22 Nov 2018 03:15:10 +0100
parents 238f5027830c
children 1090d6637cfd
line wrap: on
line source

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
:set encoding=utf-8
ENDTEST

Results of test69:

STARTTEST
/^{/+1
:set tw=2 fo=t
gqgqjgqgqo
XYZ
abc XYZ
ENDTEST

{
XYZ
abc XYZ
}

STARTTEST
/^{/+1
:set tw=1 fo=tm
gqgqjgqgqjgqgqjgqgqjgqgqo

Xa
X a
XY
X Y
ENDTEST

{

Xa
X a
XY
X Y
}

STARTTEST
/^{/+1
:set tw=2 fo=tm
gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqo

Xa
X a
XY
X Y
aX
abX
abcX
abX c
abXY
ENDTEST

{

Xa
X a
XY
X Y
aX
abX
abcX
abX c
abXY
}

STARTTEST
/^{/+1
:set ai tw=2 fo=tm
gqgqjgqgqo

Xa
ENDTEST

{

  Xa
}

STARTTEST
/^{/+1
:set noai tw=2 fo=tm
gqgqjgqgqo

  Xa
ENDTEST

{

  Xa
}

STARTTEST
/^{/+1
:set tw=2 fo=cqm comments=n:X
gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqo

Xa
XaY
XY
XYZ
X Y
X YZ
XX
XXa
XXY
ENDTEST

{

Xa
XaY
XY
XYZ
X Y
X YZ
XX
XXa
XXY
}

STARTTEST
/^{/+1
:set tw=2 fo=tm
RXa
ENDTEST

{

}

STARTTEST
/^{/+1
:set mps+=u2018:u2019
d%
ENDTEST

{
‘ two three ’ four
}
STARTTEST
/^ra test
jVjra
ENDTEST

ra test
abba
aab

STARTTEST
:set whichwrap+=h
/^x
dh
:set whichwrap-=h
ENDTEST

á
x

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
/^substitute
:let y = substitute('123', '\zs', 'a', 'g')    | put =y
ENDTEST

substitute

STARTTEST
:g/^STARTTEST/.,/^ENDTEST/d
:1;/^Results/,$wq! test.out
ENDTEST