To: vim_dev@googlegroups.com Subject: Patch 8.1.2060 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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:". 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:". 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 = [ + \ "