about summary refs log tree commit diff stats
path: root/src/common.h
Commit message (Expand)AuthorAgeFilesLines
* Update copyright to include 2019Michael Vetter2019-01-221-1/+1
* Merge pull request #1011 from jubalh/sha1Michael Vetter2018-09-191-2/+0
|\
| * Move p_sha1_hash() to stanza.cMichael Vetter2018-09-061-2/+0
* | use gio functions for file copyPhilip Flohr2018-09-061-1/+1
|/
* Move ID generation to xmpp folderMichael Vetter2018-08-301-1/+0
* Use uuid in create_unique_id instead of counterMichael Vetter2018-08-141-1/+0
* Update copyrightJames Booth2018-01-211-1/+1
* Update Glib dependency to 2.40James Booth2017-03-251-20/+0
* Allow installing plugins from directoryJames Booth2017-02-051-0/+4
* Update CopyrightJames Booth2017-01-281-1/+1
* Move window functions to window_list.cJames Booth2016-07-241-3/+1
* Move resource conversionsJames Booth2016-07-241-6/+1
* Add config/files.cJames Booth2016-07-241-2/+0
* Update GPL link in headersJames Booth2016-07-241-1/+1
* Add /plugins install commandJames Booth2016-07-121-0/+1
* Added whole word matches for room mentionJames Booth2016-04-071-1/+2
* Added prof_strstr functionJames Booth2016-04-031-1/+2
* Updated copyrightJames Booth2016-02-141-1/+1
* Applied coding style to src/James Booth2015-10-261-2/+1
* Use consistent style for pointersMichael Vetter2015-10-211-13/+13
* Create is_notify_enabled functionMichael Vetter2015-10-121-0/+1
* Fixed OTR decryption checkJames Booth2015-08-271-1/+1
* Added str_contains_str to commonJames Booth2015-08-261-0/+1
* I removed ncurses header dependencies, removed unused codeJames Booth2015-06-151-7/+0
* Added more connect testsJames Booth2015-05-241-0/+1
* Moved _strtoi to common, strtoi_rangeJames Booth2015-03-161-0/+1
* Merge branch 'master' into readlineJames Booth2015-02-111-1/+1
|\
| * Updated copyrightJames Booth2015-02-101-1/+1
* | Merge branch 'master' into readlineJames Booth2015-02-081-0/+1
|\|
| * Moved quote stripper to common, added testsJames Booth2015-02-081-0/+1
* | Refactor inputwin.cJames Booth2015-01-181-0/+8
|/
* Added utf8_display_lenJames Booth2015-01-171-0/+1
* Simplified autocompleters and command historyJames Booth2015-01-161-1/+1
* fgets: buffer sizePeter Vilim2015-01-071-0/+5
* Follow symlinks for profrc and accounts filesJames Booth2014-10-261-0/+2
* Added license exemption for OpenSSL to source headersJames Booth2014-08-241-0/+12
* Renamed generate_unique_id -> create_unique_idJames Booth2014-06-151-1/+1
* Renamed sha1 functions to avoid naming clashesJames Booth2014-06-151-1/+1
* Fixed define for g_hash_table_contains (glib < 2.32)James Booth2014-05-221-1/+1
* Added g_hash_table_contains for glib < 2.32James Booth2014-05-221-0/+2
* Added glib g_hash_table_add for glib < 2.32James Booth2014-05-221-0/+6
* Added backwards compatible g_list_free_full for glib < 2.28James Booth2014-05-211-0/+2
* Changed to use gnutls instead of openssl for sha1 hashingJames Booth2014-05-011-0/+1
* Updated copyrightJames Booth2014-03-091-1/+1
* generate_unique_id allows prefixJames Booth2014-01-251-1/+1
* Removed unused encode.xmlJames Booth2014-01-211-1/+0
* Removed limit on number of windows, WIPJames Booth2013-08-271-1/+1
* Added function to get next available window number, and testsJames Booth2013-08-271-0/+3
* remove octet_compareDmitry Podgorny2013-08-261-1/+0
* refactored mkdir_recursiveDmitry Podgorny2013-08-031-2/+2
dbox buttons implemented in edit/' href='/akkartik/mu/commit/edit/007-sandbox-delete.mu?h=hlt&id=09b8717b2bd253b5dee7df34ef1db93d27b93dd4'>09b8717b ^
a90faae9 ^
3d8b137c ^
09b8717b ^


a90faae9 ^
4e7186fa ^
ea5e7fd4 ^
a90faae9 ^




09b8717b ^
2d91279b ^
a90faae9 ^
b0403c18 ^
09b8717b ^
3d8b137c ^
09b8717b ^

2d91279b ^
09b8717b ^
3d8b137c ^


09b8717b ^


2d91279b ^
09b8717b ^


2d91279b ^
09b8717b ^




2d91279b ^
09b8717b ^

2d91279b ^
3d8b137c ^
ea5e7fd4 ^
09b8717b ^

2d91279b ^
09b8717b ^
ea5e7fd4 ^
a90faae9 ^
09b8717b ^

2d91279b ^
09b8717b ^
a90faae9 ^
09b8717b ^
3d8b137c ^
09b8717b ^



a90faae9 ^
09b8717b ^
2d91279b ^
09b8717b ^
a90faae9 ^
ea5e7fd4 ^
3d8b137c ^
ea5e7fd4 ^

09b8717b ^
ea5e7fd4 ^
09b8717b ^
3d8b137c ^

ea5e7fd4 ^
ea5e7fd4 ^



a01dd595 ^
6f65d591 ^
a01dd595 ^
dd30f56d ^
a01dd595 ^
55479bc2 ^
6f65d591 ^
a01dd595 ^






11569717 ^
a01dd595 ^
55479bc2 ^
a01dd595 ^
dd30f56d ^
ceeb92d4 ^
71056d61 ^


ceeb92d4 ^
71056d61 ^
a01dd595 ^


dd30f56d ^
a01dd595 ^

55479bc2 ^
a01dd595 ^


dd30f56d ^
ceeb92d4 ^
71056d61 ^


ceeb92d4 ^
71056d61 ^
a01dd595 ^



6f65d591 ^
a01dd595 ^
dd30f56d ^
a01dd595 ^
55479bc2 ^
6f65d591 ^
a01dd595 ^






11569717 ^
a01dd595 ^
55479bc2 ^
a01dd595 ^
dd30f56d ^
ceeb92d4 ^
71056d61 ^


ceeb92d4 ^
71056d61 ^
a01dd595 ^


dd30f56d ^
a01dd595 ^

55479bc2 ^
a01dd595 ^


dd30f56d ^
ceeb92d4 ^
71056d61 ^


ceeb92d4 ^
71056d61 ^
a01dd595 ^



6f65d591 ^
a01dd595 ^
dd30f56d ^
a01dd595 ^
55479bc2 ^
6f65d591 ^
a01dd595 ^






11569717 ^

a01dd595 ^
55479bc2 ^
a01dd595 ^
dd30f56d ^
ceeb92d4 ^
71056d61 ^


ceeb92d4 ^
71056d61 ^
a01dd595 ^


dd30f56d ^
a01dd595 ^

55479bc2 ^
a01dd595 ^


dd30f56d ^
71056d61 ^
ceeb92d4 ^
71056d61 ^


ceeb92d4 ^
71056d61 ^
a01dd595 ^



6f65d591 ^
a01dd595 ^
dd30f56d ^
a01dd595 ^
55479bc2 ^
6f65d591 ^
a01dd595 ^







55479bc2 ^
a01dd595 ^
dd30f56d ^
71056d61 ^
ceeb92d4 ^
71056d61 ^


ceeb92d4 ^
71056d61 ^


a01dd595 ^


dd30f56d ^
11569717 ^

a01dd595 ^

55479bc2 ^
a01dd595 ^


dd30f56d ^
ceeb92d4 ^
71056d61 ^


ceeb92d4 ^
71056d61 ^
a01dd595 ^

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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333


                             
             
                                       
                                    
                                                                 







                                      
                                 

                                                                                                          
                                                                                                            
                                                                                                                                                                                                                                                                                                                  


                                                                                                            
                                                                                                                                                                                                              



                                                                                                            
                                                                                                                                                                                                              
                                                                                                            
   
                                                                     
                  
                    

       
                                   


                                                                                                          
                                                                                                            
                                                                                                                                                                                                                                                                                                                  


                                                                                                            
                                                                                                                                                                                                              

                                                                                                            
   
                                                                     



                    
                                   


                                                                                                          
                                                                                                            
                                                                                                                                                                                                                                                                                                                  

                                                                                                            



                      
                           
   
                                                                       


                                                     
                      
                                                     
                                                                                    




                          
                                                       
                                                                                              
             
                  
                                    
                                                                                 

                                                                     
                                                            
                            


                                                                                                      


                                                                                
                                                                                                              


                                                                                    
                                                  




                                          
                                                                              

                  
                                                    
                                                    
   

                               
                                                                    
                                                  
   
   

                           
                                               
                                                          
     
                                                                   
                                                



                                                            
     
                                  
                                                                    
                                                                         
   
                        
                                                           

                                                             
                                            
   
                         

                                                          
                              



                                            
                                        
             
                                       
                                    
                          
                                                                 
                                






                                           
                   
   
                                 
                         
                                                                                                          
                                                                                                                                                                                                              


                                                                                                                                                                                                                
                                                                                                                                                                                                              
                                                                                                            


                             
                    

       
                                   


                                                                          
                                                                                                          
                                                                                                                                                                                                              


                                                                                                                                                                                                                
                                                                                                                                                                                                              
                                                                                                            



                                            
             
                                       
                                    
                          
                                                                 
                                






                                           
                   
   
                                 
                         
                                                                                                          
                                                                                                                                                                                                              


                                                                                                                                                                                                                
                                                                                                                                                                                                              
                                                                                                            


                             
                    

       
                                   


                                                                          
                                                                                                          
                                                                                                                                                                                                              


                                                                                                                                                                                                                
                                                                                                                                                                                                              
                                                                                                            



                                              
             
                                       
                                    
                          
                                                                 
                                






                                           

                   
   
                                 
                         
                                                                                                          
                                                                                                                                                                                                              


                                                                                                                                                                                                                
                                                                                                                                                                                                              
                                                                                                            


                             
                    

       
                                   


                                         
                                                                                                          
                                                                                                            
                                                                                                                                                                                                                                                                                                                  


                                                                                                            
                                                                                                                                                                                                              
                                                                                                            



                                         
             
                                       
                                    
                          
                                                                 
                                







                      
                                 
                         
                                                                                                          
                                                                                                            
                                                                                                                                                                                                                                                                                                                  


                                                                                                            
                                                                                                                                                                                                              


                                                                                                            


                                                            
                    

                   

       
                                   


                                  
                                                                                                          
                                                                                                                                                                                                              


                                                                                                                                                                                                                
                                                                                                                                                                                                              
                                                                                                            

   
## deleting sandboxes

scenario deleting-sandboxes [
  local-scope
  trace-until 100/app  # trace too long
  assume-screen 100/width, 15/height
  env:&:environment <- new-programming-environment screen, [], []
  # run a few commands
  assume-console [
    left-click 1, 80
    type [divide-with-remainder 11, 3]
    press F4
    type [add 2, 2]
    press F4
  ]
  event-loop screen, console, env
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                                                                   .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
    .                                                  0   edit          copy            delete         .
    .                                                  add 2, 2                                         .
    .                                                  4                                                .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                  1   edit          copy            delete         .
    .                                                  divide-with-remainder 11, 3                      .
    .                                                  3                                                .
    .                                                  2                                                .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                                                                   .
  ]
  # delete second sandbox by clicking on left edge of 'delete' button
  assume-console [
    left-click 7, 85
  ]
  run [
    event-loop screen, console, env
  ]
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                                                                   .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
    .                                                  0   edit          copy            delete         .
    .                                                  add 2, 2                                         .
    .                                                  4                                                .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                                                                   .
    .                                                                                                   .
  ]
  # delete first sandbox by clicking at right edge of 'delete' button
  assume-console [
    left-click 3, 99
  ]
  run [
    event-loop screen, console, env
  ]
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                                                                   .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
    .                                                                                                   .
    .                                                                                                   .
  ]
]

after <global-touch> [
  # support 'delete' button
  {
    delete?:bool <- should-attempt-delete? click-row, click-column, env
    break-unless delete?
    delete?, env <- try-delete-sandbox click-row, env
    break-unless delete?
    hide-screen screen
    screen <- render-sandbox-side screen, env, render
    screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env
    show-screen screen
    loop +next-event:label
  }
]

# some preconditions for attempting to delete a sandbox
def should-attempt-delete? click-row:num, click-column:num, env:&:environment -> result:bool [
  local-scope
  load-ingredients
  # are we below the sandbox editor?
  click-sandbox-area?:bool <- click-on-sandbox-area? click-row, click-column, env
  reply-unless click-sandbox-area?, 0/false
  # narrower, is the click in the columns spanning the 'copy' button?
  first-sandbox:&:editor <- get *env, current-sandbox:offset
  assert first-sandbox, [!!]
  sandbox-left-margin:num <- get *first-sandbox, left:offset
  sandbox-right-margin:num <- get *first-sandbox, right:offset
  _, _, _, _, delete-button-left:num <- sandbox-menu-columns sandbox-left-margin, sandbox-right-margin
  result <- within-range? click-column, delete-button-left, sandbox-right-margin
]

def try-delete-sandbox click-row:num, env:&:environment -> clicked-on-delete-button?:bool, env:&:environment [
  local-scope
  load-ingredients
  # identify the sandbox to delete, if the click was actually on the 'delete' button
  sandbox:&:sandbox <- find-sandbox env, click-row
  return-unless sandbox, 0/false
  clicked-on-delete-button? <- copy 1/true
  env <- delete-sandbox env, sandbox
]

def delete-sandbox env:&:environment, sandbox:&:sandbox -> env:&:environment [
  local-scope
  load-ingredients
  curr-sandbox:&:sandbox <- get *env, sandbox:offset
  first-sandbox?:bool <- equal curr-sandbox, sandbox
  {
    # first sandbox? pop
    break-unless first-sandbox?
    next-sandbox:&:sandbox <- get *curr-sandbox, next-sandbox:offset
    *env <- put *env, sandbox:offset, next-sandbox
  }
  {
    # not first sandbox?
    break-if first-sandbox?
    prev-sandbox:&:sandbox <- copy curr-sandbox
    curr-sandbox <- get *curr-sandbox, next-sandbox:offset
    {
      assert curr-sandbox, [sandbox not found! something is wrong.]
      found?:bool <- equal curr-sandbox, sandbox
      break-if found?
      prev-sandbox <- copy curr-sandbox
      curr-sandbox <- get *curr-sandbox, next-sandbox:offset
      loop
    }
    # snip sandbox out of its list
    next-sandbox:&:sandbox <- get *curr-sandbox, next-sandbox:offset
    *prev-sandbox <- put *prev-sandbox, next-sandbox:offset, next-sandbox
  }
  # update sandbox count
  sandbox-count:num <- get *env, number-of-sandboxes:offset
  sandbox-count <- subtract sandbox-count, 1
  *env <- put *env, number-of-sandboxes:offset, sandbox-count
  # reset scroll if deleted sandbox was last
  {
    break-if next-sandbox
    render-from:num <- get *env, render-from:offset
    reset-scroll?:bool <- equal render-from, sandbox-count
    break-unless reset-scroll?
    *env <- put *env, render-from:offset, -1
  }
]

scenario deleting-sandbox-after-scroll [
  local-scope
  trace-until 100/app  # trace too long
  assume-screen 100/width, 10/height
  # initialize environment
  env:&:environment <- new-programming-environment screen, [], []
  render-all screen, env, render
  # create 2 sandboxes and scroll to second
  assume-console [
    press ctrl-n
    type [add 2, 2]
    press F4
    type [add 1, 1]
    press F4
    press page-down
  ]
  event-loop screen, console, env
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                  ┊─────────────────────────────────────────────────.
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
    .                                                  add 1, 1                                         .
    .                                                  2                                                .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                  1   edit          copy            delete         .
  ]
  # delete the second sandbox
  assume-console [
    left-click 6, 99
  ]
  run [
    event-loop screen, console, env
  ]
  # second sandbox shows in editor; scroll resets to display first sandbox
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                  ┊─────────────────────────────────────────────────.
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
    .                                                  add 1, 1                                         .
    .                                                  2                                                .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                                                                   .
  ]
]

scenario deleting-top-sandbox-after-scroll [
  local-scope
  trace-until 100/app  # trace too long
  assume-screen 100/width, 10/height
  # initialize environment
  env:&:environment <- new-programming-environment screen, [], []
  render-all screen, env, render
  # create 2 sandboxes and scroll to second
  assume-console [
    press ctrl-n
    type [add 2, 2]
    press F4
    type [add 1, 1]
    press F4
    press page-down
  ]
  event-loop screen, console, env
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                  ┊─────────────────────────────────────────────────.
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
    .                                                  add 1, 1                                         .
    .                                                  2                                                .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                  1   edit          copy            delete         .
  ]
  # delete the second sandbox
  assume-console [
    left-click 2, 99
  ]
  run [
    event-loop screen, console, env
  ]
  # second sandbox shows in editor; scroll resets to display first sandbox
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                  ┊─────────────────────────────────────────────────.
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
    .                                                  add 2, 2                                         .
    .                                                  4                                                .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                                                                   .
  ]
]

scenario deleting-final-sandbox-after-scroll [
  local-scope
  trace-until 100/app  # trace too long
  assume-screen 100/width, 10/height
  # initialize environment
  env:&:environment <- new-programming-environment screen, [], []
  render-all screen, env, render
  # create 2 sandboxes and scroll to second
  assume-console [
    press ctrl-n
    type [add 2, 2]
    press F4
    type [add 1, 1]
    press F4
    press page-down
    press page-down
  ]
  event-loop screen, console, env
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                  ┊─────────────────────────────────────────────────.
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1   edit          copy            delete         .
    .                                                  add 2, 2                                         .
    .                                                  4                                                .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                                                                   .
  ]
  # delete the second sandbox
  assume-console [
    left-click 2, 99
  ]
  run [
    event-loop screen, console, env
  ]
  # implicitly scroll up to first sandbox
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                                                                   .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
    .                                                  0   edit          copy            delete         .
    .                                                  add 1, 1                                         .
    .                                                  2                                                .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                                                                   .
  ]
]

scenario deleting-updates-sandbox-count [
  local-scope
  trace-until 100/app  # trace too long
  assume-screen 100/width, 10/height
  # initialize environment
  env:&:environment <- new-programming-environment screen, [], []
  render-all screen, env, render
  # create 2 sandboxes
  assume-console [
    press ctrl-n
    type [add 2, 2]
    press F4
    type [add 1, 1]
    press F4
  ]
  event-loop screen, console, env
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                                                                   .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
    .                                                  0   edit          copy            delete         .
    .                                                  add 1, 1                                         .
    .                                                  2                                                .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                  1   edit          copy            delete         .
    .                                                  add 2, 2                                         .
    .                                                  4                                                .
  ]
  # delete the second sandbox, then try to scroll down twice
  assume-console [
    left-click 3, 99
    press page-down
    press page-down
  ]
  run [
    event-loop screen, console, env
  ]
  # shouldn't go past last sandbox
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                  ┊─────────────────────────────────────────────────.
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0   edit          copy            delete         .
    .                                                  add 2, 2                                         .
    .                                                  4                                                .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                                                                   .
  ]
]