From 47391b18e2084f2747b10aa6158bc40e03f01528 Mon Sep 17 00:00:00 2001 From: Felipe Morales Date: Thu, 26 Jun 2014 00:21:57 -0400 Subject: Port vim's patch 7.4.338 ('breakindent') --- src/nvim/testdir/test_breakindent.in | 79 ++++++++++++++++++++++++++++++++++++ src/nvim/testdir/test_breakindent.ok | 55 +++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 src/nvim/testdir/test_breakindent.in create mode 100644 src/nvim/testdir/test_breakindent.ok (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_breakindent.in b/src/nvim/testdir/test_breakindent.in new file mode 100644 index 0000000000..8f40e4f7e5 --- /dev/null +++ b/src/nvim/testdir/test_breakindent.in @@ -0,0 +1,79 @@ +Test for breakindent + +STARTTEST +:so small.vim +:if !exists("+breakindent") | e! test.ok | w! test.out | qa! | endif +:10new|:vsp|:vert resize 20 +:put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\" +:set ts=4 sw=4 sts=4 breakindent +:fu! ScreenChar(width) +: let c='' +: for i in range(1,a:width) +: let c.=nr2char(screenchar(line('.'), i)) +: endfor +: let c.="\n" +: for i in range(1,a:width) +: let c.=nr2char(screenchar(line('.')+1, i)) +: endfor +: let c.="\n" +: for i in range(1,a:width) +: let c.=nr2char(screenchar(line('.')+2, i)) +: endfor +: return c +:endfu +:fu DoRecordScreen() +: wincmd l +: $put =printf(\"\n%s\", g:test) +: $put =g:line1 +: wincmd p +:endfu +:let g:test="Test 1: Simple breakindent" +:let line1=ScreenChar(8) +:call DoRecordScreen() +:let g:test="Test 2: Simple breakindent + sbr=>>" +:set sbr=>> +:let line1=ScreenChar(8) +:call DoRecordScreen() +:let g:test ="Test 3: Simple breakindent + briopt:sbr" +:set briopt=sbr,min:0 sbr=++ +:let line1=ScreenChar(8) +:call DoRecordScreen() +:let g:test ="Test 4: Simple breakindent + min width: 18" +:set sbr= briopt=min:18 +:let line1=ScreenChar(8) +:call DoRecordScreen() +:let g:test =" Test 5: Simple breakindent + shift by 2" +:set briopt=shift:2,min:0 +:let line1=ScreenChar(8) +:call DoRecordScreen() +:let g:test=" Test 6: Simple breakindent + shift by -1" +:set briopt=shift:-1,min:0 +:let line1=ScreenChar(8) +:call DoRecordScreen() +:let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr" +:set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 +:let line1=ScreenChar(10) +:call DoRecordScreen() +:let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr" +:set briopt=shift:1,sbr,min:0 nu sbr=# list +:let line1=ScreenChar(10) +:call DoRecordScreen() +:let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list" +:set briopt-=sbr +:let line1=ScreenChar(10) +:call DoRecordScreen() +:let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n" +:set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0 +:let line1=ScreenChar(10) +:call DoRecordScreen() +:wincmd p +:let g:test="\n Test 11: strdisplaywidth when breakindent is on" +:set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4 +:let text=getline(2) "skip leading tab when calculating text width +:let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times +:$put =g:test +:$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width) +:%w! test.out +:qa! +ENDTEST +dummy text diff --git a/src/nvim/testdir/test_breakindent.ok b/src/nvim/testdir/test_breakindent.ok new file mode 100644 index 0000000000..723cb25012 --- /dev/null +++ b/src/nvim/testdir/test_breakindent.ok @@ -0,0 +1,55 @@ + + abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP + +Test 1: Simple breakindent + abcd + qrst + GHIJ + +Test 2: Simple breakindent + sbr=>> + abcd + >>qr + >>EF + +Test 3: Simple breakindent + briopt:sbr + abcd +++ qrst +++ GHIJ + +Test 4: Simple breakindent + min width: 18 + abcd + qrstuv + IJKLMN + + Test 5: Simple breakindent + shift by 2 + abcd + qr + EF + + Test 6: Simple breakindent + shift by -1 + abcd + qrstu + HIJKL + + Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr + 2 ab +? m +? x + + Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr + 2 ^Iabcd +# opq +# BCD + + Test 9: breakindent + shift by +1 + 'nu' + sbr=# list + 2 ^Iabcd + #op + #AB + + Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n + 2 ab +~ mn +~ yz + + Test 11: strdisplaywidth when breakindent is on +strdisplaywidth: 46 == calculated: 64 -- cgit From dfdfee0260a95eb020d0b9cea2273b1f5002c184 Mon Sep 17 00:00:00 2001 From: Felipe Morales Date: Sat, 16 Aug 2014 12:58:11 -0400 Subject: vim-patch: 7.4.353 Make 'breakindent' work with the 'list' option. Originally patched in vim patch 7.4.353, by chrisbra (https://code.google.com/p/vim/source/detail?r=d42a1d3b74d40f580359dbd139d2d0dfa7235252) Updated version.c. --- src/nvim/testdir/test_listlbr.in | 62 ++++++++++++++++++++++++++++++++++++++++ src/nvim/testdir/test_listlbr.ok | 39 +++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 src/nvim/testdir/test_listlbr.in create mode 100644 src/nvim/testdir/test_listlbr.ok (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_listlbr.in b/src/nvim/testdir/test_listlbr.in new file mode 100644 index 0000000000..0d50d4b060 --- /dev/null +++ b/src/nvim/testdir/test_listlbr.in @@ -0,0 +1,62 @@ +Test for linebreak and list option + +STARTTEST +:so small.vim +:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif +:10new|:vsp|:vert resize 20 +:put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \" +:norm! zt +:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap +:fu! ScreenChar(width) +: let c='' +: for j in range(1,4) +: for i in range(1,a:width) +: let c.=nr2char(screenchar(j, i)) +: endfor +: let c.="\n" +: endfor +: return c +:endfu +:fu! DoRecordScreen() +: wincmd l +: $put =printf(\"\n%s\", g:test) +: $put =g:line +: wincmd p +:endfu +:let g:test="Test 1: set linebreak" +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:let g:test="Test 2: set linebreak + set list" +:set linebreak list listchars= +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:let g:test ="Test 3: set linebreak + set list + fancy listchars" +:exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6" +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:let g:test ="Test 4: set linebreak nolist" +:set nolist linebreak +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:let g:test ="Test 5: set nolinebreak list" +:set list nolinebreak +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:let g:test ="Test 6: set linebreak with tab and 1 line as long as screen: should break!" +:set nolist linebreak ts=8 +:let line="1\t".repeat('a', winwidth(0)-2) +:$put =line +:$ +:norm! zt +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:%w! test.out +:qa! +ENDTEST +dummy text diff --git a/src/nvim/testdir/test_listlbr.ok b/src/nvim/testdir/test_listlbr.ok new file mode 100644 index 0000000000..f391d50aea --- /dev/null +++ b/src/nvim/testdir/test_listlbr.ok @@ -0,0 +1,39 @@ + + abcdef hijklmn pqrstuvwxyz 1060ABCDEFGHIJKLMNOP + +Test 1: set linebreak + abcdef ++hijklmn ++pqrstuvwxyz 1060ABC ++DEFGHIJKLMNOP + +Test 2: set linebreak + set list +^Iabcdef hijklmn^I ++pqrstuvwxyz 1060ABC ++DEFGHIJKLMNOP + + +Test 3: set linebreak + set list + fancy listchars +▕———abcdef ++hijklmn▕——— ++pqrstuvwxyz␣1060ABC ++DEFGHIJKLMNOPˑ¶ + +Test 4: set linebreak nolist + abcdef ++hijklmn ++pqrstuvwxyz 1060ABC ++DEFGHIJKLMNOP + +Test 5: set nolinebreak list +▕———abcdef hijklmn▕— ++pqrstuvwxyz␣1060ABC ++DEFGHIJKLMNOPˑ¶ +¶ +1 aaaaaaaaaaaaaaaaaa + +Test 6: set linebreak with tab and 1 line as long as screen: should break! +1 ++aaaaaaaaaaaaaaaaaa +~ +~ -- cgit From 91aabcb75b2ff8fa3b718e2f08b5f723f5900d0f Mon Sep 17 00:00:00 2001 From: Felipe Morales Date: Sat, 16 Aug 2014 15:46:30 -0400 Subject: vim-patch:7.4.370 Problem: Linebreak test fails when encoding is not utf-8. (Danek Duvall) Solution: Split the test in a single byte one and a utf-8 one. (Christian Brabandt) --- src/nvim/testdir/test_listlbr.in | 18 ++++----------- src/nvim/testdir/test_listlbr.ok | 24 +++++--------------- src/nvim/testdir/test_listlbr_utf8.in | 41 +++++++++++++++++++++++++++++++++++ src/nvim/testdir/test_listlbr_utf8.ok | 14 ++++++++++++ 4 files changed, 65 insertions(+), 32 deletions(-) create mode 100644 src/nvim/testdir/test_listlbr_utf8.in create mode 100644 src/nvim/testdir/test_listlbr_utf8.ok (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_listlbr.in b/src/nvim/testdir/test_listlbr.in index 0d50d4b060..0cce4c23a5 100644 --- a/src/nvim/testdir/test_listlbr.in +++ b/src/nvim/testdir/test_listlbr.in @@ -1,10 +1,10 @@ -Test for linebreak and list option +Test for linebreak and list option (non-utf8) STARTTEST :so small.vim :if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif :10new|:vsp|:vert resize 20 -:put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \" +:put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \" :norm! zt :set ts=4 sw=4 sts=4 linebreak sbr=+ wrap :fu! ScreenChar(width) @@ -32,22 +32,12 @@ STARTTEST :redraw! :let line=ScreenChar(winwidth(0)) :call DoRecordScreen() -:let g:test ="Test 3: set linebreak + set list + fancy listchars" -:exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6" -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:let g:test ="Test 4: set linebreak nolist" +:let g:test ="Test 3: set linebreak nolist" :set nolist linebreak :redraw! :let line=ScreenChar(winwidth(0)) :call DoRecordScreen() -:let g:test ="Test 5: set nolinebreak list" -:set list nolinebreak -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:let g:test ="Test 6: set linebreak with tab and 1 line as long as screen: should break!" +:let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!" :set nolist linebreak ts=8 :let line="1\t".repeat('a', winwidth(0)-2) :$put =line diff --git a/src/nvim/testdir/test_listlbr.ok b/src/nvim/testdir/test_listlbr.ok index f391d50aea..be323d4dc7 100644 --- a/src/nvim/testdir/test_listlbr.ok +++ b/src/nvim/testdir/test_listlbr.ok @@ -1,38 +1,26 @@ - abcdef hijklmn pqrstuvwxyz 1060ABCDEFGHIJKLMNOP + abcdef hijklmn pqrstuvwxyz_1060ABCDEFGHIJKLMNOP Test 1: set linebreak abcdef +hijklmn -+pqrstuvwxyz 1060ABC ++pqrstuvwxyz_1060ABC +DEFGHIJKLMNOP Test 2: set linebreak + set list ^Iabcdef hijklmn^I -+pqrstuvwxyz 1060ABC ++pqrstuvwxyz_1060ABC +DEFGHIJKLMNOP -Test 3: set linebreak + set list + fancy listchars -▕———abcdef -+hijklmn▕——— -+pqrstuvwxyz␣1060ABC -+DEFGHIJKLMNOPˑ¶ - -Test 4: set linebreak nolist +Test 3: set linebreak nolist abcdef +hijklmn -+pqrstuvwxyz 1060ABC ++pqrstuvwxyz_1060ABC +DEFGHIJKLMNOP - -Test 5: set nolinebreak list -▕———abcdef hijklmn▕— -+pqrstuvwxyz␣1060ABC -+DEFGHIJKLMNOPˑ¶ -¶ 1 aaaaaaaaaaaaaaaaaa -Test 6: set linebreak with tab and 1 line as long as screen: should break! +Test 4: set linebreak with tab and 1 line as long as screen: should break! 1 +aaaaaaaaaaaaaaaaaa ~ diff --git a/src/nvim/testdir/test_listlbr_utf8.in b/src/nvim/testdir/test_listlbr_utf8.in new file mode 100644 index 0000000000..f8888d5332 --- /dev/null +++ b/src/nvim/testdir/test_listlbr_utf8.in @@ -0,0 +1,41 @@ +Test for linebreak and list option in utf-8 mode + +STARTTEST +:so small.vim +:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif +:so mbyte.vim +:if &enc !=? 'utf-8'|:e! test.ok|:w! test.out|qa!|endif +:10new|:vsp|:vert resize 20 +:put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \" +:norm! zt +:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap +:fu! ScreenChar(width) +: let c='' +: for j in range(1,4) +: for i in range(1,a:width) +: let c.=nr2char(screenchar(j, i)) +: endfor +: let c.="\n" +: endfor +: return c +:endfu +:fu! DoRecordScreen() +: wincmd l +: $put =printf(\"\n%s\", g:test) +: $put =g:line +: wincmd p +:endfu +:let g:test ="Test 1: set linebreak + set list + fancy listchars" +:exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6" +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:let g:test ="Test 2: set nolinebreak list" +:set list nolinebreak +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:%w! test.out +:qa! +ENDTEST +dummy text diff --git a/src/nvim/testdir/test_listlbr_utf8.ok b/src/nvim/testdir/test_listlbr_utf8.ok new file mode 100644 index 0000000000..576ccfb401 --- /dev/null +++ b/src/nvim/testdir/test_listlbr_utf8.ok @@ -0,0 +1,14 @@ + + abcdef hijklmn pqrstuvwxyz 1060ABCDEFGHIJKLMNOP + +Test 1: set linebreak + set list + fancy listchars +▕———abcdef ++hijklmn▕——— ++pqrstuvwxyz␣1060ABC ++DEFGHIJKLMNOPˑ¶ + +Test 2: set nolinebreak list +▕———abcdef hijklmn▕— ++pqrstuvwxyz␣1060ABC ++DEFGHIJKLMNOPˑ¶ +¶ -- cgit From 2e1c74586959e1f023d7d708af55258ba91a929c Mon Sep 17 00:00:00 2001 From: Felipe Morales Date: Sat, 16 Aug 2014 15:48:41 -0400 Subject: vim-patch:7.4.388 Problem: With 'linebreak' set and 'list' unset a Tab is not counted properly. (Kent Sibilev) Solution: Check the 'list' option. (Christian Brabandt) --- src/nvim/testdir/test_listlbr_utf8.in | 11 +++++++++++ src/nvim/testdir/test_listlbr_utf8.ok | 7 +++++++ 2 files changed, 18 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_listlbr_utf8.in b/src/nvim/testdir/test_listlbr_utf8.in index f8888d5332..ba12adae05 100644 --- a/src/nvim/testdir/test_listlbr_utf8.in +++ b/src/nvim/testdir/test_listlbr_utf8.in @@ -30,11 +30,22 @@ STARTTEST :redraw! :let line=ScreenChar(winwidth(0)) :call DoRecordScreen() +:" :let g:test ="Test 2: set nolinebreak list" :set list nolinebreak :redraw! :let line=ScreenChar(winwidth(0)) :call DoRecordScreen() +:" +:let g:test ="Test 3: set linebreak nolist" +:$put =\"\t*mask = nil;\" +:$ +:norm! zt +:set nolist linebreak +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:" :%w! test.out :qa! ENDTEST diff --git a/src/nvim/testdir/test_listlbr_utf8.ok b/src/nvim/testdir/test_listlbr_utf8.ok index 576ccfb401..634cf3906d 100644 --- a/src/nvim/testdir/test_listlbr_utf8.ok +++ b/src/nvim/testdir/test_listlbr_utf8.ok @@ -12,3 +12,10 @@ Test 2: set nolinebreak list +pqrstuvwxyz␣1060ABC +DEFGHIJKLMNOPˑ¶ ¶ + *mask = nil; + +Test 3: set linebreak nolist + *mask = nil; +~ +~ +~ -- cgit From 3b0f7fe59392138c886063b09e3cf41b25d53056 Mon Sep 17 00:00:00 2001 From: Felipe Morales Date: Tue, 19 Aug 2014 01:36:33 -0400 Subject: update src/nvim/testdir/Makefile include breakindent and list related tests --- src/nvim/testdir/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index a7f9dd8fa1..db88755a01 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -30,8 +30,10 @@ SCRIPTS := test_autoformat_join.out \ test91.out test92.out test93.out test94.out test95.out \ test96.out test97.out test98.out test99.out test100.out \ test101.out test102.out test103.out test104.out test105.out \ - test106.out test107.out \ - test_options.out + test106.out test107.out \ + test_options.out \ + test_listlbr.out test_listlbr_utf8.out \ + test_breakindent.out SCRIPTS_GUI := test16.out -- cgit