comparison src/testdir/test_breakindent.vim @ 27128:164d59ddd48a v8.2.4093

patch 8.2.4093: cached breakindent values not initialized properly Commit: https://github.com/vim/vim/commit/c53b467473160b5cfce77277fbae414bf43e66ce Author: Christian Brabandt <cb@256bit.org> Date: Sat Jan 15 10:01:05 2022 +0000 patch 8.2.4093: cached breakindent values not initialized properly Problem: Cached breakindent values not initialized properly. Solution: Initialize and cache formatlistpat. (Christian Brabandt, closes #9526, closes #9512)
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 Jan 2022 11:15:03 +0100
parents b079bdc99c18
children d2471d710ec9
comparison
equal deleted inserted replaced
27127:33918a28ec46 27128:164d59ddd48a
847 redraw! 847 redraw!
848 call assert_equal([" >>aaa^@\"a:"], ScreenLines(2, 14)) 848 call assert_equal([" >>aaa^@\"a:"], ScreenLines(2, 14))
849 %bw! 849 %bw!
850 endfunc 850 endfunc
851 851
852 func Test_no_spurious_match()
853 let s:input = printf('- y %s y %s', repeat('x', 50), repeat('x', 50))
854 call s:test_windows('setl breakindent breakindentopt=list:-1 formatlistpat=^- hls')
855 let @/ = '\%>3v[y]'
856 redraw!
857 call searchcount().total->assert_equal(1)
858 " cleanup
859 set hls&vim
860 let s:input = "\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP"
861 bwipeout!
862 endfunc
863
864 func Test_no_extra_indent()
865 call s:test_windows('setl breakindent breakindentopt=list:-1,min:10')
866 %d
867 let &l:formatlistpat='^\s*\d\+\.\s\+'
868 let text = 'word '
869 let len = text->strcharlen()
870 let line1 = text->repeat((winwidth(0) / len) * 2)
871 let line2 = repeat(' ', 2) .. '1. ' .. line1
872 call setline(1, [line2])
873 redraw!
874 " 1) matches formatlist pattern, so indent
875 let expect = [
876 \ " 1. word word word ",
877 \ " word word word ",
878 \ " word word ",
879 \ "~ ",
880 \ ]
881 let lines = s:screen_lines2(1, 4, 20)
882 call s:compare_lines(expect, lines)
883 " 2) change formatlist pattern
884 " -> indent adjusted
885 let &l:formatlistpat='^\s*\d\+\.'
886 let expect = [
887 \ " 1. word word word ",
888 \ " word word word ",
889 \ " word word ",
890 \ "~ ",
891 \ ]
892 let lines = s:screen_lines2(1, 4, 20)
893 " 3) add something in front, no additional indent
894 norm! gg0
895 exe ":norm! 5iword \<esc>"
896 redraw!
897 let expect = [
898 \ "word word word word ",
899 \ "word 1. word word ",
900 \ "word word word word ",
901 \ "word word ",
902 \ "~ ",
903 \ ]
904 let lines = s:screen_lines2(1, 5, 20)
905 call s:compare_lines(expect, lines)
906 bwipeout!
907 endfunc
908
852 " vim: shiftwidth=2 sts=2 expandtab 909 " vim: shiftwidth=2 sts=2 expandtab