summaryrefslogtreecommitdiffstats
path: root/src/libvterm/t/62screen_damage.test
blob: 32cac2d0a177cbc65811f540e32b8e79a1d59211 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
INIT
WANTSCREEN aDb

!Putglyph
RESET
  damage 0..25,0..80
PUSH "123"
  damage 0..1,0..1 = 0<31>
  damage 0..1,1..2 = 0<32>
  damage 0..1,2..3 = 0<33>

!Erase
PUSH "\e[H"
PUSH "\e[3X"
  damage 0..1,0..3

!Scroll damages entire line in two chunks
PUSH "\e[H\e[5@"
  damage 0..1,5..80
  damage 0..1,0..5

!Scroll down damages entire screen in two chunks
PUSH "\e[T"
  damage 1..25,0..80
  damage 0..1,0..80

!Altscreen damages entire area
PUSH "\e[?1049h"
  damage 0..25,0..80
PUSH "\e[?1049l"
  damage 0..25,0..80

WANTSCREEN m

!Scroll invokes moverect but not damage
PUSH "\e[5@"
  moverect 0..1,0..75 -> 0..1,5..80
  damage 0..1,0..5

WANTSCREEN -m

!Merge to cells
RESET
  damage 0..25,0..80
DAMAGEMERGE CELL

PUSH "A"
  damage 0..1,0..1 = 0<41>
PUSH "B"
  damage 0..1,1..2 = 0<42>
PUSH "C"
  damage 0..1,2..3 = 0<43>

!Merge entire rows
RESET
  damage 0..25,0..80
DAMAGEMERGE ROW

PUSH "ABCDE\r\nEFGH"
  damage 0..1,0..5 = 0<41 42 43 44 45>
DAMAGEFLUSH
  damage 1..2,0..4 = 1<45 46 47 48>
PUSH "\e[3;6r\e[6H\eD"
  damage 2..5,0..80
DAMAGEFLUSH
  damage 5..6,0..80

!Merge entire screen
RESET
  damage 0..25,0..80
DAMAGEMERGE SCREEN

PUSH "ABCDE\r\nEFGH"
DAMAGEFLUSH
  damage 0..2,0..5 = 0<41 42 43 44 45> 1<45 46 47 48>
PUSH "\e[3;6r\e[6H\eD"
DAMAGEFLUSH
  damage 2..6,0..80

!Merge entire screen with moverect
WANTSCREEN m

RESET
  damage 0..25,0..80
DAMAGEMERGE SCREEN

PUSH "ABCDE\r\nEFGH"
PUSH "\e[3;6r\e[6H\eD"
  damage 0..2,0..5 = 0<41 42 43 44 45> 1<45 46 47 48>
  moverect 3..6,0..80 -> 2..5,0..80
DAMAGEFLUSH
  damage 5..6,0..80

!Merge scroll
RESET
  damage 0..25,0..80
DAMAGEMERGE SCROLL

PUSH "\e[H1\r\n2\r\n3"
PUSH "\e[25H\n\n\n"
  sb_pushline 80 = 31
  sb_pushline 80 = 32
  sb_pushline 80 = 33
DAMAGEFLUSH
  moverect 3..25,0..80 -> 0..22,0..80
  damage 0..25,0..80

!Merge scroll with damage
PUSH "\e[25H"
PUSH "ABCDE\r\nEFGH\r\n"
  sb_pushline 80 =
  sb_pushline 80 =
DAMAGEFLUSH
  moverect 2..25,0..80 -> 0..23,0..80
  damage 22..25,0..80 = 22<41 42 43 44 45> 23<45 46 47 48>

!Merge scroll with damage past region
PUSH "\e[3;6r\e[6H1\r\n2\r\n3\r\n4\r\n5"
DAMAGEFLUSH
  damage 2..6,0..80 = 2<32> 3<33> 4<34> 5<35>

!Damage entirely outside scroll region
PUSH "\e[HABC\e[3;6r\e[6H\r\n6"
  damage 0..1,0..3 = 0<41 42 43>
DAMAGEFLUSH
  moverect 3..6,0..80 -> 2..5,0..80
  damage 5..6,0..80 = 5<36>

!Damage overlapping scroll region
PUSH "\e[H\e[2J"
DAMAGEFLUSH
  damage 0..25,0..80

PUSH "\e[HABCD\r\nEFGH\r\nIJKL\e[2;5r\e[5H\r\nMNOP"
DAMAGEFLUSH
  moverect 2..5,0..80 -> 1..4,0..80
  damage 0..5,0..80 = 0<41 42 43 44> 1<49 4A 4B 4C>
  ## TODO: is this right?

!Merge scroll*2 with damage
RESET
  damage 0..25,0..80
DAMAGEMERGE SCROLL

PUSH "\e[25H\r\nABCDE\b\b\b\e[2P\r\n"
  sb_pushline 80 =
  moverect 1..25,0..80 -> 0..24,0..80
  damage 24..25,0..80 = 24<41 42 43 44 45>
  moverect 24..25,4..80 -> 24..25,2..78
  damage 24..25,78..80
  sb_pushline 80 =
DAMAGEFLUSH
  moverect 1..25,0..80 -> 0..24,0..80
  damage 24..25,0..80
  ?screen_chars 23,0,24,5 = "ABE"