summaryrefslogtreecommitdiffstats
path: root/src/libvterm/t/63screen_resize.test
blob: 6835222db7cd4567fe6935c35a62e85dabfe19eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
INIT
WANTSTATE
WANTSCREEN

!Resize wider preserves cells
RESET
RESIZE 25,80
PUSH "AB\r\nCD"
  ?screen_chars 0,0,1,80 = "AB"
  ?screen_chars 1,0,2,80 = "CD"
RESIZE 25,100
  ?screen_chars 0,0,1,100 = "AB"
  ?screen_chars 1,0,2,100 = "CD"

!Resize wider allows print in new area
RESET
RESIZE 25,80
PUSH "AB\e[79GCD"
  ?screen_chars 0,0,1,2 = "AB"
  ?screen_chars 0,78,1,80 = "CD"
RESIZE 25,100
  ?screen_chars 0,0,1,2 = "AB"
  ?screen_chars 0,78,1,80 = "CD"
PUSH "E"
  ?screen_chars 0,78,1,81 = "CDE"

!Resize shorter with blanks just truncates
RESET
RESIZE 25,80
PUSH "Top\e[10HLine 10"
  ?screen_row 0 = "Top"
  ?screen_row 9 = "Line 10"
  ?cursor = 9,7
RESIZE 20,80
  ?screen_row 0 = "Top"
  ?screen_row 9 = "Line 10"
  ?cursor = 9,7

!Resize shorter with content must scroll
RESET
RESIZE 25,80
PUSH "Top\e[25HLine 25\e[15H"
  ?screen_row 0 = "Top"
  ?screen_row 24 = "Line 25"
  ?cursor = 14,0
WANTSCREEN b
RESIZE 20,80
  sb_pushline 80 = 54 6F 70
  sb_pushline 80 =
  sb_pushline 80 =
  sb_pushline 80 =
  sb_pushline 80 =
  ?screen_row 0  = ""
  ?screen_row 19 = "Line 25"
  ?cursor = 9,0

!Resize shorter does not lose line with cursor
# See also https://github.com/neovim/libvterm/commit/1b745d29d45623aa8d22a7b9288c7b0e331c7088
RESET
WANTSCREEN -b
RESIZE 25,80
WANTSCREEN b
PUSH "\e[24HLine 24\r\nLine 25\r\n"
  sb_pushline 80 =
  ?screen_row 23 = "Line 25"
  ?cursor = 24,0
RESIZE 24,80
  sb_pushline 80 =
  ?screen_row 22 = "Line 25"
  ?cursor = 23,0

!Resize shorter does not send the cursor to a negative row
# See also https://github.com/vim/vim/pull/6141
RESET
WANTSCREEN -b
RESIZE 25,80
WANTSCREEN b
PUSH "\e[24HLine 24\r\nLine 25\e[H"
  ?cursor = 0,0
RESIZE 20,80
  sb_pushline 80 =
  sb_pushline 80 =
  sb_pushline 80 =
  sb_pushline 80 =
  sb_pushline 80 =
  ?cursor = 0,0

!Resize taller attempts to pop scrollback
RESET
WANTSCREEN -b
RESIZE 25,80
PUSH "Line 1\e[25HBottom\e[15H"
  ?screen_row 0  = "Line 1"
  ?screen_row 24 = "Bottom"
  ?cursor = 14,0
WANTSCREEN b
RESIZE 30,80
  sb_popline 80
  sb_popline 80
  sb_popline 80
  sb_popline 80
  sb_popline 80
  ?screen_row 0  = "ABCDE"
  ?screen_row 5  = "Line 1"
  ?screen_row 29 = "Bottom"
  ?cursor = 19,0
WANTSCREEN -b

!Resize can operate on altscreen
RESET
WANTSCREEN a
RESIZE 25,80
PUSH "Main screen\e[?1049h\e[HAlt screen"
RESIZE 30,80
  ?screen_row 0 = "Alt screen"
PUSH "\e[?1049l"
  ?screen_row 0 = "Main screen"