blob: 6856759ecc6e9c62112bc5d22e7ec818b781488d [file] [log] [blame]
Bram Moolenaar62706602016-12-09 19:28:48 +01001" Test for displaying stuff
2if !has('gui_running') && has('unix')
3 set term=ansi
4endif
5
Bram Moolenaarc6cd8402017-03-29 14:40:47 +02006source view_util.vim
Bram Moolenaar3c8ee622019-08-03 22:55:50 +02007source check.vim
8source screendump.vim
Bram Moolenaar62706602016-12-09 19:28:48 +01009
Bram Moolenaar1e115362019-01-09 23:01:02 +010010func Test_display_foldcolumn()
Bram Moolenaar3c8ee622019-08-03 22:55:50 +020011 CheckFeature folding
12
Bram Moolenaar62706602016-12-09 19:28:48 +010013 new
14 vnew
15 vert resize 25
Bram Moolenaar70892372016-12-09 19:51:49 +010016 call assert_equal(25, winwidth(winnr()))
17 set isprint=@
Bram Moolenaar62706602016-12-09 19:28:48 +010018
19 1put='e more noise blah blah‚ more stuff here'
20
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020021 let expect = [
22 \ "e more noise blah blah<82",
23 \ "> more stuff here "
24 \ ]
Bram Moolenaar62706602016-12-09 19:28:48 +010025
26 call cursor(2, 1)
27 norm! zt
Bram Moolenaar3c8ee622019-08-03 22:55:50 +020028 let lines = ScreenLines([1,2], winwidth(0))
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020029 call assert_equal(expect, lines)
Bram Moolenaar62706602016-12-09 19:28:48 +010030 set fdc=2
Bram Moolenaar3c8ee622019-08-03 22:55:50 +020031 let lines = ScreenLines([1,2], winwidth(0))
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020032 let expect = [
33 \ " e more noise blah blah<",
34 \ " 82> more stuff here "
35 \ ]
36 call assert_equal(expect, lines)
Bram Moolenaar62706602016-12-09 19:28:48 +010037
38 quit!
39 quit!
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020040endfunc
41
Bram Moolenaar1e115362019-01-09 23:01:02 +010042func Test_display_foldtext_mbyte()
Bram Moolenaar3c8ee622019-08-03 22:55:50 +020043 CheckFeature folding
44
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020045 call NewWindow(10, 40)
46 call append(0, range(1,20))
47 exe "set foldmethod=manual foldtext=foldtext() fillchars=fold:\u2500,vert:\u2502 fdc=2"
48 call cursor(2, 1)
49 norm! zf13G
50 let lines=ScreenLines([1,3], winwidth(0)+1)
51 let expect=[
52 \ " 1 \u2502",
53 \ "+ +-- 12 lines: 2". repeat("\u2500", 23). "\u2502",
54 \ " 14 \u2502",
55 \ ]
56 call assert_equal(expect, lines)
Bram Moolenaar8da1e6c2017-03-29 20:38:59 +020057
58 set fillchars=fold:-,vert:\|
59 let lines=ScreenLines([1,3], winwidth(0)+1)
60 let expect=[
61 \ " 1 |",
62 \ "+ +-- 12 lines: 2". repeat("-", 23). "|",
63 \ " 14 |",
64 \ ]
65 call assert_equal(expect, lines)
66
Bram Moolenaarc6cd8402017-03-29 14:40:47 +020067 set foldtext& fillchars& foldmethod& fdc&
68 bw!
69endfunc
Bram Moolenaar3c8ee622019-08-03 22:55:50 +020070
71" check that win_ins_lines() and win_del_lines() work when t_cs is empty.
72func Test_scroll_without_region()
73 CheckScreendump
74
75 let lines =<< trim END
76 call setline(1, range(1, 20))
77 set t_cs=
78 set laststatus=2
79 END
80 call writefile(lines, 'Xtestscroll')
81 let buf = RunVimInTerminal('-S Xtestscroll', #{rows: 10})
82
83 call VerifyScreenDump(buf, 'Test_scroll_no_region_1', {})
84
85 call term_sendkeys(buf, ":3delete\<cr>")
86 call VerifyScreenDump(buf, 'Test_scroll_no_region_2', {})
87
88 call term_sendkeys(buf, ":4put\<cr>")
89 call VerifyScreenDump(buf, 'Test_scroll_no_region_3', {})
90
Bram Moolenaar7cc53512019-08-03 23:30:21 +020091 call term_sendkeys(buf, ":undo\<cr>")
92 call term_sendkeys(buf, ":undo\<cr>")
93 call term_sendkeys(buf, ":set laststatus=0\<cr>")
94 call VerifyScreenDump(buf, 'Test_scroll_no_region_4', {})
95
96 call term_sendkeys(buf, ":3delete\<cr>")
97 call VerifyScreenDump(buf, 'Test_scroll_no_region_5', {})
98
99 call term_sendkeys(buf, ":4put\<cr>")
100 call VerifyScreenDump(buf, 'Test_scroll_no_region_6', {})
101
Bram Moolenaar3c8ee622019-08-03 22:55:50 +0200102 " clean up
103 call StopVimInTerminal(buf)
104 call delete('Xtestscroll')
105endfunc