Mercurial > vim
diff src/testdir/test_breakindent.vim @ 34327:cb3d20e3dcd9 v9.1.0097
patch 9.1.0097: 'breakindent' behaves inconsistently with 'list' and splits
Commit: https://github.com/vim/vim/commit/efabd7c8d4f733350364356b8950a11f013aec49
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun Feb 11 17:16:19 2024 +0100
patch 9.1.0097: 'breakindent' behaves inconsistently with 'list' and splits
Problem: 'breakindent' behaves inconsistently with 'list' and splits.
Solution: Use 'listchars' from the correct window and handle caching
properly. Move cheaper comparisons to the top.
(zeertzjq)
closes: #14008
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 11 Feb 2024 17:30:02 +0100 |
parents | ffabf0c57e9f |
children | 29a814bbb630 |
line wrap: on
line diff
--- a/src/testdir/test_breakindent.vim +++ b/src/testdir/test_breakindent.vim @@ -424,7 +424,7 @@ func Test_breakindent12() \ "~ ", \ ] call s:compare_lines(expect, lines) - call s:close_windows('set nuw=4 listchars=') + call s:close_windows('set nuw=4 listchars&') endfunc func Test_breakindent12_vartabs() @@ -439,7 +439,7 @@ func Test_breakindent12_vartabs() \ "~ ", \ ] call s:compare_lines(expect, lines) - call s:close_windows('set nuw=4 listchars= vts&') + call s:close_windows('set nuw=4 listchars& vts&') endfunc func Test_breakindent13() @@ -1086,5 +1086,51 @@ func Test_linebreak_list() bwipe! endfunc +func Test_breakindent_change_display_uhex() + call s:test_windows('setl briopt=min:0 list listchars=eol:$') + redraw! + let lines = s:screen_lines(line('.'), 20) + let expect = [ + \ "^Iabcdefghijklmnopqr", + \ " stuvwxyzABCDEFGHIJ", + \ " KLMNOP$ " + \ ] + call s:compare_lines(expect, lines) + set display+=uhex + redraw! + let lines = s:screen_lines(line('.'), 20) + let expect = [ + \ "<09>abcdefghijklmnop", + \ " qrstuvwxyzABCDEF", + \ " GHIJKLMNOP$ " + \ ] + call s:compare_lines(expect, lines) + set display& + + call s:close_windows() +endfunc + +func Test_breakindent_list_split() + 10new + 61vsplit + setlocal tabstop=8 breakindent list listchars=tab:<->,eol:$ + put =s:input + 30vsplit + setlocal listchars=eol:$ + let expect = [ + \ "^IabcdefghijklmnopqrstuvwxyzAB|<------>abcdefghijklmnopqrstuv", + \ " CDEFGHIJKLMNOP$ | wxyzABCDEFGHIJKLMNOP$ ", + \ "~ |~ " + \ ] + redraw! + let lines = s:screen_lines(line('.'), 61) + call s:compare_lines(expect, lines) + wincmd p + redraw! + let lines = s:screen_lines(line('.'), 61) + call s:compare_lines(expect, lines) + + bwipe! +endfunc " vim: shiftwidth=2 sts=2 expandtab