summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_breakindent.vim
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2021-07-14 20:00:27 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-14 20:00:27 +0200
commit4a0b85ad0193ac162e2d8458e4b1c5ad2e2b0193 (patch)
tree8544c63fd11c6e52fc46369173da3ea2ad41f6bf /src/testdir/test_breakindent.vim
parent5bea41dea34bcc73c4efb1b554ad0a2018966ecc (diff)
patch 8.2.3160: 'breakindent' does not work well for bulleted listsv8.2.3160
Problem: 'breakindent' does not work well for bulleted and numbered lists. Solution: Add the "list" entry to 'breakindentopt'. (Christian Brabandt, closes #8564, closes #1661)
Diffstat (limited to 'src/testdir/test_breakindent.vim')
-rw-r--r--src/testdir/test_breakindent.vim70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/testdir/test_breakindent.vim b/src/testdir/test_breakindent.vim
index bb0f6dd4a9..bfca06aec0 100644
--- a/src/testdir/test_breakindent.vim
+++ b/src/testdir/test_breakindent.vim
@@ -15,6 +15,10 @@ func s:screen_lines(lnum, width) abort
return ScreenLines([a:lnum, a:lnum + 2], a:width)
endfunc
+func s:screen_lines2(lnums, lnume, width) abort
+ return ScreenLines([a:lnums, a:lnume], a:width)
+endfunc
+
func s:compare_lines(expect, actual)
call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
endfunc
@@ -708,4 +712,70 @@ func Test_breakindent20_cpo_n_nextpage()
call s:close_windows('set breakindent& briopt& cpo& number&')
endfunc
+func Test_breakindent20_list()
+ call s:test_windows('setl breakindent breakindentopt= linebreak')
+ " default:
+ call setline(1, [' 1. Congress shall make no law',
+ \ ' 2.) Congress shall make no law',
+ \ ' 3.] Congress shall make no law'])
+ norm! 1gg
+ redraw!
+ let lines = s:screen_lines2(1, 6, 20)
+ let expect = [
+ \ " 1. Congress ",
+ \ "shall make no law ",
+ \ " 2.) Congress ",
+ \ "shall make no law ",
+ \ " 3.] Congress ",
+ \ "shall make no law ",
+ \ ]
+ call s:compare_lines(expect, lines)
+ " set mininum indent
+ setl briopt=min:5
+ redraw!
+ let lines = s:screen_lines2(1, 6, 20)
+ let expect = [
+ \ " 1. Congress ",
+ \ " shall make no law ",
+ \ " 2.) Congress ",
+ \ " shall make no law ",
+ \ " 3.] Congress ",
+ \ " shall make no law ",
+ \ ]
+ call s:compare_lines(expect, lines)
+ " set additional handing indent
+ setl briopt+=list:4
+ redraw!
+ let expect = [
+ \ " 1. Congress ",
+ \ " shall make no ",
+ \ " law ",
+ \ " 2.) Congress ",
+ \ " shall make no ",
+ \ " law ",
+ \ " 3.] Congress ",
+ \ " shall make no ",
+ \ " law ",
+ \ ]
+ let lines = s:screen_lines2(1, 9, 20)
+ call s:compare_lines(expect, lines)
+ " reset linebreak option
+ " Note: it indents by one additional
+ " space, because of the leading space.
+ setl linebreak&vim list listchars=eol:$,space:_
+ redraw!
+ let expect = [
+ \ "__1.__Congress_shall",
+ \ " _make_no_law$ ",
+ \ "__2.)_Congress_shall",
+ \ " _make_no_law$ ",
+ \ "__3.]_Congress_shall",
+ \ " _make_no_law$ ",
+ \ ]
+ let lines = s:screen_lines2(1, 6, 20)
+ call s:compare_lines(expect, lines)
+
+ call s:close_windows('set breakindent& briopt& linebreak& list& listchars&')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab