@@ -15,6 +15,10 @@ func s:screen_lines(lnum, width) abort
1515 return ScreenLines ([a: lnum , a: lnum + 2 ], a: width )
1616endfunc
1717
18+ func s: screen_lines2 (lnums, lnume, width) abort
19+ return ScreenLines ([a: lnums , a: lnume ], a: width )
20+ endfunc
21+
1822func s: compare_lines (expect, actual)
1923 call assert_equal (join (a: expect , " \n " ), join (a: actual , " \n " ))
2024endfunc
@@ -708,4 +712,70 @@ func Test_breakindent20_cpo_n_nextpage()
708712 call s: close_windows (' set breakindent& briopt& cpo& number&' )
709713endfunc
710714
715+ func Test_breakindent20_list ()
716+ call s: test_windows (' setl breakindent breakindentopt= linebreak' )
717+ " default:
718+ call setline (1 , [' 1. Congress shall make no law' ,
719+ \ ' 2.) Congress shall make no law' ,
720+ \ ' 3.] Congress shall make no law' ])
721+ norm! 1 gg
722+ redraw !
723+ let lines = s: screen_lines2 (1 , 6 , 20 )
724+ let expect = [
725+ \ " 1. Congress " ,
726+ \ " shall make no law " ,
727+ \ " 2.) Congress " ,
728+ \ " shall make no law " ,
729+ \ " 3.] Congress " ,
730+ \ " shall make no law " ,
731+ \ ]
732+ call s: compare_lines (expect, lines )
733+ " set mininum indent
734+ setl briopt = min :5
735+ redraw !
736+ let lines = s: screen_lines2 (1 , 6 , 20 )
737+ let expect = [
738+ \ " 1. Congress " ,
739+ \ " shall make no law " ,
740+ \ " 2.) Congress " ,
741+ \ " shall make no law " ,
742+ \ " 3.] Congress " ,
743+ \ " shall make no law " ,
744+ \ ]
745+ call s: compare_lines (expect, lines )
746+ " set additional handing indent
747+ setl briopt += list :4
748+ redraw !
749+ let expect = [
750+ \ " 1. Congress " ,
751+ \ " shall make no " ,
752+ \ " law " ,
753+ \ " 2.) Congress " ,
754+ \ " shall make no " ,
755+ \ " law " ,
756+ \ " 3.] Congress " ,
757+ \ " shall make no " ,
758+ \ " law " ,
759+ \ ]
760+ let lines = s: screen_lines2 (1 , 9 , 20 )
761+ call s: compare_lines (expect, lines )
762+ " reset linebreak option
763+ " Note: it indents by one additional
764+ " space, because of the leading space.
765+ setl linebreak &vim list listchars = eol :$ ,space:_
766+ redraw !
767+ let expect = [
768+ \ " __1.__Congress_shall" ,
769+ \ " _make_no_law$ " ,
770+ \ " __2.)_Congress_shall" ,
771+ \ " _make_no_law$ " ,
772+ \ " __3.]_Congress_shall" ,
773+ \ " _make_no_law$ " ,
774+ \ ]
775+ let lines = s: screen_lines2 (1 , 6 , 20 )
776+ call s: compare_lines (expect, lines )
777+
778+ call s: close_windows (' set breakindent& briopt& linebreak& list& listchars&' )
779+ endfunc
780+
711781" vim: shiftwidth = 2 sts = 2 expandtab
0 commit comments