Patch 8.1.2060
Problem: "precedes" in 'listchars' not used properly.
Solution: Correctly handle the "precedes" char in list mode for long lines.
(Christian Brabandt, closes #4953)
Files: runtime/doc/options.txt, src/drawline.c,
src/testdir/test_display.vim, src/testdir/view_util.vim
*** ../vim-8.1.2059/runtime/doc/options.txt 2019-09-15 13:16:55.204317458
+0200
--- runtime/doc/options.txt 2019-09-20 16:47:34.548600327 +0200
***************
*** 4840,4848 ****
off and the line continues beyond the right of the
screen.
*lcs-precedes*
! precedes:c Character to show in the first column, when 'wrap'
! is off and there is text preceding the character
! visible in the first column.
*lcs-conceal*
conceal:c Character to show in place of concealed text, when
'conceallevel' is set to 1.
--- 4842,4850 ----
off and the line continues beyond the right of the
screen.
*lcs-precedes*
! precedes:c Character to show in the first visible column of the
! physical line, when there is text preceding the
! character visible in the first column.
*lcs-conceal*
conceal:c Character to show in place of concealed text, when
'conceallevel' is set to 1.
*** ../vim-8.1.2059/src/drawline.c 2019-09-19 23:05:56.471034946 +0200
--- src/drawline.c 2019-09-20 16:49:22.111884099 +0200
***************
*** 2482,2488 ****
// special character (via 'listchars' option "precedes:<char>".
if (lcs_prec_todo != NUL
&& wp->w_p_list
! && (wp->w_p_wrap ? wp->w_skipcol > 0 : wp->w_leftcol > 0)
#ifdef FEAT_DIFF
&& filler_todo <= 0
#endif
--- 2482,2490 ----
// special character (via 'listchars' option "precedes:<char>".
if (lcs_prec_todo != NUL
&& wp->w_p_list
! && (wp->w_p_wrap ?
! (wp->w_skipcol > 0 && row == 0) :
! wp->w_leftcol > 0)
#ifdef FEAT_DIFF
&& filler_todo <= 0
#endif
*** ../vim-8.1.2059/src/testdir/test_display.vim 2019-08-03
23:29:56.991355034 +0200
--- src/testdir/test_display.vim 2019-09-20 16:51:49.142862599 +0200
***************
*** 103,105 ****
--- 103,160 ----
call StopVimInTerminal(buf)
call delete('Xtestscroll')
endfunc
+
+ func Test_display_listchars_precedes()
+ call NewWindow(10, 10)
+ " Need a physical line that wraps over the complete
+ " window size
+ call append(0, repeat('aaa aaa aa ', 10))
+ call append(1, repeat(['bbb bbb bbb bbb'], 2))
+ " remove blank trailing line
+ $d
+ set list nowrap
+ call cursor(1, 1)
+ " move to end of line and scroll 2 characters back
+ norm! $2zh
+ let lines=ScreenLines([1,4], winwidth(0)+1)
+ let expect = [
+ \ " aaa aa $ |",
+ \ "$ |",
+ \ "$ |",
+ \ "~ |",
+ \ ]
+ call assert_equal(expect, lines)
+ set list listchars+=precedes:< nowrap
+ call cursor(1, 1)
+ " move to end of line and scroll 2 characters back
+ norm! $2zh
+ let lines = ScreenLines([1,4], winwidth(0)+1)
+ let expect = [
+ \ "<aaa aa $ |",
+ \ "< |",
+ \ "< |",
+ \ "~ |",
+ \ ]
+ call assert_equal(expect, lines)
+ set wrap
+ call cursor(1, 1)
+ " the complete line should be displayed in the window
+ norm! $
+
+ let lines = ScreenLines([1,10], winwidth(0)+1)
+ let expect = [
+ \ "<aaa aaa a|",
+ \ "a aaa aaa |",
+ \ "aa aaa aaa|",
+ \ " aa aaa aa|",
+ \ "a aa aaa a|",
+ \ "aa aa aaa |",
+ \ "aaa aa aaa|",
+ \ " aaa aa aa|",
+ \ "a aaa aa a|",
+ \ "aa aaa aa |",
+ \ ]
+ call assert_equal(expect, lines)
+ set list& listchars& wrap&
+ bw!
+ endfunc
*** ../vim-8.1.2059/src/testdir/view_util.vim 2019-06-23 00:49:50.985715087
+0200
--- src/testdir/view_util.vim 2019-09-20 16:47:34.552600308 +0200
***************
*** 54,59 ****
--- 54,60 ----
function! NewWindow(height, width) abort
exe a:height . 'new'
exe a:width . 'vsp'
+ set winfixwidth winfixheight
redraw!
endfunction
*** ../vim-8.1.2059/src/version.c 2019-09-20 13:40:10.784920381 +0200
--- src/version.c 2019-09-20 16:58:05.960521993 +0200
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 2060,
/**/
--
Eight Megabytes And Continually Swapping.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201909201501.x8KF1W79019766%40masaka.moolenaar.net.