summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_display.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-20 17:00:17 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-20 17:00:17 +0200
commitbffba7f7042f6082e75b42484b15f66087b01941 (patch)
tree3fcb97d519845afa946d27dbd41b03456a2d33c8 /src/testdir/test_display.vim
parent589edb340454e7f1b19358f129287a636d53d0e1 (diff)
patch 8.1.2060: "precedes" in 'listchars' not used properlyv8.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)
Diffstat (limited to 'src/testdir/test_display.vim')
-rw-r--r--src/testdir/test_display.vim55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/testdir/test_display.vim b/src/testdir/test_display.vim
index 6856759ecc..f500dc7891 100644
--- a/src/testdir/test_display.vim
+++ b/src/testdir/test_display.vim
@@ -103,3 +103,58 @@ func Test_scroll_without_region()
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