diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 17:54:55 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 17:54:55 -0700 |
commit | 2d91279bacda12ea42608b4aa74f66589772fce9 (patch) | |
tree | e5d8aafa6b34d32234239a77496c2f0c3d3899b1 /edit/003-shortcuts.mu | |
parent | f344b250f6f062a1a1902bf69b23ebf9b565de0e (diff) | |
download | mu-2d91279bacda12ea42608b4aa74f66589772fce9.tar.gz |
3396
Diffstat (limited to 'edit/003-shortcuts.mu')
-rw-r--r-- | edit/003-shortcuts.mu | 570 |
1 files changed, 285 insertions, 285 deletions
diff --git a/edit/003-shortcuts.mu b/edit/003-shortcuts.mu index f2704a6a..70917808 100644 --- a/edit/003-shortcuts.mu +++ b/edit/003-shortcuts.mu @@ -9,12 +9,12 @@ scenario editor-inserts-two-spaces-on-tab [ # just one character in final line 1:text <- new [ab cd] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right assume-console [ press tab ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -41,17 +41,17 @@ after <handle-special-character> [ scenario editor-handles-backspace-key [ assume-screen 10/width, 5/height 1:text <- new [abc] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace assume-console [ left-click 1, 1 press backspace ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 4:num <- get *2:&:editor-data, cursor-row:offset - 5:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 4:num <- get *2:&:editor, cursor-row:offset + 5:num <- get *2:&:editor, cursor-column:offset ] screen-should-contain [ . . @@ -80,7 +80,7 @@ after <handle-special-character> [ # return values: # go-render? - whether caller needs to update the screen # backspaced-cell - value deleted (or 0 if nothing was deleted) so we can save it for undo, etc. -def delete-before-cursor editor:&:editor-data, screen:&:screen -> editor:&:editor-data, screen:&:screen, go-render?:bool, backspaced-cell:&:duplex-list:char [ +def delete-before-cursor editor:&:editor, screen:&:screen -> editor:&:editor, screen:&:screen, go-render?:bool, backspaced-cell:&:duplex-list:char [ local-scope load-ingredients before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset @@ -131,7 +131,7 @@ def delete-before-cursor editor:&:editor-data, screen:&:screen -> editor:&:edito go-render? <- copy 0/false ] -def move-cursor-coordinates-left editor:&:editor-data -> editor:&:editor-data, go-render?:bool [ +def move-cursor-coordinates-left editor:&:editor -> editor:&:editor, go-render?:bool [ local-scope load-ingredients before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset @@ -220,15 +220,15 @@ scenario editor-clears-last-line-on-backspace [ # just one character in final line 1:text <- new [ab cd] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right assume-console [ left-click 2, 0 # cursor at only character in final line press backspace ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 4:num <- get *2:&:editor-data, cursor-row:offset - 5:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 4:num <- get *2:&:editor, cursor-row:offset + 5:num <- get *2:&:editor, cursor-column:offset ] screen-should-contain [ . . @@ -247,8 +247,8 @@ scenario editor-joins-and-wraps-lines-on-backspace [ # initialize editor with two long-ish but non-wrapping lines 1:text <- new [abc def ghi jkl] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # position the cursor at the start of the second and hit backspace assume-console [ @@ -256,7 +256,7 @@ ghi jkl] press backspace ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # resulting single line should wrap correctly screen-should-contain [ @@ -272,8 +272,8 @@ scenario editor-wraps-long-lines-on-backspace [ assume-screen 10/width, 5/height # initialize editor in part of the screen with a long line 1:text <- new [abc def ghij] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 8/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 8/right + editor-render screen, 2:&:editor # confirm that it wraps screen-should-contain [ . . @@ -288,7 +288,7 @@ scenario editor-wraps-long-lines-on-backspace [ press backspace ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # resulting single line should wrap correctly and not overflow its bounds screen-should-contain [ @@ -305,14 +305,14 @@ scenario editor-wraps-long-lines-on-backspace [ scenario editor-handles-delete-key [ assume-screen 10/width, 5/height 1:text <- new [abc] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace assume-console [ press delete ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -326,7 +326,7 @@ scenario editor-handles-delete-key [ press delete ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -348,7 +348,7 @@ after <handle-special-key> [ } ] -def delete-at-cursor editor:&:editor-data, screen:&:screen -> editor:&:editor-data, screen:&:screen, go-render?:bool, deleted-cell:&:duplex-list:char [ +def delete-at-cursor editor:&:editor, screen:&:screen -> editor:&:editor, screen:&:screen, go-render?:bool, deleted-cell:&:duplex-list:char [ local-scope load-ingredients before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset @@ -394,15 +394,15 @@ def delete-at-cursor editor:&:editor-data, screen:&:screen -> editor:&:editor-da scenario editor-moves-cursor-right-with-key [ assume-screen 10/width, 5/height 1:text <- new [abc] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace assume-console [ press right-arrow type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -432,7 +432,7 @@ after <handle-special-key> [ } ] -def move-cursor-coordinates-right editor:&:editor-data, screen-height:num -> editor:&:editor-data, go-render?:bool [ +def move-cursor-coordinates-right editor:&:editor, screen-height:num -> editor:&:editor, go-render?:bool [ local-scope load-ingredients before-cursor:&:duplex-list:char <- get *editor before-cursor:offset @@ -492,8 +492,8 @@ scenario editor-moves-cursor-to-next-line-with-right-arrow [ assume-screen 10/width, 5/height 1:text <- new [abc d] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # type right-arrow a few times to get to start of second line assume-console [ @@ -503,7 +503,7 @@ d] press right-arrow # next line ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] check-trace-count-for-label 0, [print-character] # type something and ensure it goes where it should @@ -511,7 +511,7 @@ d] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -527,8 +527,8 @@ scenario editor-moves-cursor-to-next-line-with-right-arrow-2 [ assume-screen 10/width, 5/height 1:text <- new [abc d] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 1/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 1/left, 10/right + editor-render screen, 2:&:editor assume-console [ press right-arrow press right-arrow @@ -537,7 +537,7 @@ d] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -551,17 +551,17 @@ d] scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow [ assume-screen 10/width, 5/height 1:text <- new [abcdef] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right + editor-render screen, 2:&:editor $clear-trace assume-console [ left-click 1, 3 press right-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] screen-should-contain [ . . @@ -581,8 +581,8 @@ scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow-2 [ assume-screen 10/width, 5/height # line just barely wrapping 1:text <- new [abcde] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right + editor-render screen, 2:&:editor $clear-trace # position cursor at last character before wrap and hit right-arrow assume-console [ @@ -590,9 +590,9 @@ scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow-2 [ press right-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] memory-should-contain [ 3 <- 2 @@ -603,9 +603,9 @@ scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow-2 [ press right-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] memory-should-contain [ 3 <- 2 @@ -617,17 +617,17 @@ scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow-2 [ scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow-3 [ assume-screen 10/width, 5/height 1:text <- new [abcdef] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 1/left, 6/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 1/left, 6/right + editor-render screen, 2:&:editor $clear-trace assume-console [ left-click 1, 4 press right-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] screen-should-contain [ . . @@ -647,8 +647,8 @@ scenario editor-moves-cursor-to-next-line-with-right-arrow-at-end-of-line [ assume-screen 10/width, 5/height 1:text <- new [abc d] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # move to end of line, press right-arrow, type a character assume-console [ @@ -657,7 +657,7 @@ d] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # new character should be in next line screen-should-contain [ @@ -677,8 +677,8 @@ d] scenario editor-moves-cursor-left-with-key [ assume-screen 10/width, 5/height 1:text <- new [abc] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace assume-console [ left-click 1, 2 @@ -686,7 +686,7 @@ scenario editor-moves-cursor-left-with-key [ type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -721,8 +721,8 @@ scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line [ # initialize editor with two lines 1:text <- new [abc d] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # position cursor at start of second line (so there's no previous newline) assume-console [ @@ -730,9 +730,9 @@ d] press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] memory-should-contain [ 3 <- 1 @@ -747,8 +747,8 @@ scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-2 1:text <- new [abc def g] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # position cursor further down (so there's a newline before the character at # the cursor) @@ -758,7 +758,7 @@ g] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -775,8 +775,8 @@ scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-3 1:text <- new [abc def g] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # position cursor at start of text, press left-arrow, then type a character assume-console [ @@ -785,7 +785,7 @@ g] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # left-arrow should have had no effect screen-should-contain [ @@ -804,8 +804,8 @@ scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-4 1:text <- new [abc d] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # position cursor right after empty line assume-console [ @@ -814,7 +814,7 @@ d] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -830,8 +830,8 @@ scenario editor-moves-across-screen-lines-across-wrap-with-left-arrow [ assume-screen 10/width, 5/height # initialize editor with a wrapping line 1:text <- new [abcdef] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right + editor-render screen, 2:&:editor $clear-trace screen-should-contain [ . . @@ -846,9 +846,9 @@ scenario editor-moves-across-screen-lines-across-wrap-with-left-arrow [ press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] memory-should-contain [ 3 <- 1 # previous row @@ -862,8 +862,8 @@ scenario editor-moves-across-screen-lines-to-wrapping-line-with-left-arrow [ # initialize editor with a wrapping line followed by a second line 1:text <- new [abcdef g] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right + editor-render screen, 2:&:editor $clear-trace screen-should-contain [ . . @@ -878,9 +878,9 @@ g] press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] memory-should-contain [ 3 <- 2 # previous row @@ -894,8 +894,8 @@ scenario editor-moves-across-screen-lines-to-non-wrapping-line-with-left-arrow [ # initialize editor with a line on the verge of wrapping, followed by a second line 1:text <- new [abcd e] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right + editor-render screen, 2:&:editor $clear-trace screen-should-contain [ . . @@ -910,9 +910,9 @@ e] press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] memory-should-contain [ 3 <- 1 # previous row @@ -929,17 +929,17 @@ scenario editor-moves-to-previous-line-with-up-arrow [ assume-screen 10/width, 5/height 1:text <- new [abc def] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace assume-console [ left-click 2, 1 press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] memory-should-contain [ 3 <- 1 @@ -950,7 +950,7 @@ def] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -973,7 +973,7 @@ after <handle-special-key> [ } ] -def move-to-previous-line editor:&:editor-data -> editor:&:editor-data, go-render?:bool [ +def move-to-previous-line editor:&:editor -> editor:&:editor, go-render?:bool [ local-scope load-ingredients cursor-row:num <- get *editor, cursor-row:offset @@ -1045,17 +1045,17 @@ scenario editor-adjusts-column-at-previous-line [ assume-screen 10/width, 5/height 1:text <- new [ab def] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace assume-console [ left-click 2, 3 press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] memory-should-contain [ 3 <- 1 @@ -1066,7 +1066,7 @@ def] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -1081,17 +1081,17 @@ scenario editor-adjusts-column-at-empty-line [ assume-screen 10/width, 5/height 1:text <- new [ def] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace assume-console [ left-click 2, 3 press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] memory-should-contain [ 3 <- 1 @@ -1102,7 +1102,7 @@ def] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -1119,8 +1119,8 @@ scenario editor-moves-to-previous-line-from-left-margin [ 1:text <- new [abc def ghi] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # click on the third line and hit up-arrow, so you end up just after a newline assume-console [ @@ -1128,9 +1128,9 @@ ghi] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] memory-should-contain [ 3 <- 2 @@ -1141,7 +1141,7 @@ ghi] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -1158,17 +1158,17 @@ scenario editor-moves-to-next-line-with-down-arrow [ assume-screen 10/width, 5/height 1:text <- new [abc def] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # cursor starts out at (1, 0) assume-console [ press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] # ..and ends at (2, 0) memory-should-contain [ @@ -1180,7 +1180,7 @@ def] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -1203,7 +1203,7 @@ after <handle-special-key> [ } ] -def move-to-next-line editor:&:editor-data, screen-height:num -> editor:&:editor-data, go-render?:bool [ +def move-to-next-line editor:&:editor, screen-height:num -> editor:&:editor, go-render?:bool [ local-scope load-ingredients cursor-row:num <- get *editor, cursor-row:offset @@ -1263,17 +1263,17 @@ scenario editor-adjusts-column-at-next-line [ assume-screen 10/width, 5/height 1:text <- new [abc de] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace assume-console [ left-click 1, 3 press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] memory-should-contain [ 3 <- 2 @@ -1284,7 +1284,7 @@ de] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -1301,8 +1301,8 @@ scenario editor-moves-to-start-of-line-with-ctrl-a [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # start on second line, press ctrl-a assume-console [ @@ -1310,9 +1310,9 @@ scenario editor-moves-to-start-of-line-with-ctrl-a [ press ctrl-a ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 4:num <- get *2:&:editor-data, cursor-row:offset - 5:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 4:num <- get *2:&:editor, cursor-row:offset + 5:num <- get *2:&:editor, cursor-column:offset ] # cursor moves to start of line memory-should-contain [ @@ -1348,7 +1348,7 @@ after <handle-special-key> [ } ] -def move-to-start-of-line editor:&:editor-data -> editor:&:editor-data [ +def move-to-start-of-line editor:&:editor -> editor:&:editor [ local-scope load-ingredients # update cursor column @@ -1376,8 +1376,8 @@ scenario editor-moves-to-start-of-line-with-ctrl-a-2 [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # start on first line (no newline before), press ctrl-a assume-console [ @@ -1385,9 +1385,9 @@ scenario editor-moves-to-start-of-line-with-ctrl-a-2 [ press ctrl-a ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 4:num <- get *2:&:editor-data, cursor-row:offset - 5:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 4:num <- get *2:&:editor, cursor-row:offset + 5:num <- get *2:&:editor, cursor-column:offset ] # cursor moves to start of line memory-should-contain [ @@ -1401,7 +1401,7 @@ scenario editor-moves-to-start-of-line-with-home [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right $clear-trace # start on second line, press 'home' assume-console [ @@ -1409,9 +1409,9 @@ scenario editor-moves-to-start-of-line-with-home [ press home ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] # cursor moves to start of line memory-should-contain [ @@ -1425,8 +1425,8 @@ scenario editor-moves-to-start-of-line-with-home-2 [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # start on first line (no newline before), press 'home' assume-console [ @@ -1434,9 +1434,9 @@ scenario editor-moves-to-start-of-line-with-home-2 [ press home ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] # cursor moves to start of line memory-should-contain [ @@ -1452,8 +1452,8 @@ scenario editor-moves-to-end-of-line-with-ctrl-e [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # start on first line, press ctrl-e assume-console [ @@ -1461,9 +1461,9 @@ scenario editor-moves-to-end-of-line-with-ctrl-e [ press ctrl-e ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 4:num <- get *2:&:editor-data, cursor-row:offset - 5:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 4:num <- get *2:&:editor, cursor-row:offset + 5:num <- get *2:&:editor, cursor-column:offset ] # cursor moves to end of line memory-should-contain [ @@ -1476,9 +1476,9 @@ scenario editor-moves-to-end-of-line-with-ctrl-e [ type [z] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 4:num <- get *2:&:editor-data, cursor-row:offset - 5:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 4:num <- get *2:&:editor, cursor-row:offset + 5:num <- get *2:&:editor, cursor-column:offset ] memory-should-contain [ 4 <- 1 @@ -1520,7 +1520,7 @@ after <handle-special-key> [ } ] -def move-to-end-of-line editor:&:editor-data -> editor:&:editor-data [ +def move-to-end-of-line editor:&:editor -> editor:&:editor [ local-scope load-ingredients before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset @@ -1544,8 +1544,8 @@ scenario editor-moves-to-end-of-line-with-ctrl-e-2 [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # start on second line (no newline after), press ctrl-e assume-console [ @@ -1553,9 +1553,9 @@ scenario editor-moves-to-end-of-line-with-ctrl-e-2 [ press ctrl-e ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 4:num <- get *2:&:editor-data, cursor-row:offset - 5:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 4:num <- get *2:&:editor, cursor-row:offset + 5:num <- get *2:&:editor, cursor-column:offset ] # cursor moves to end of line memory-should-contain [ @@ -1569,8 +1569,8 @@ scenario editor-moves-to-end-of-line-with-end [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # start on first line, press 'end' assume-console [ @@ -1578,9 +1578,9 @@ scenario editor-moves-to-end-of-line-with-end [ press end ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] # cursor moves to end of line memory-should-contain [ @@ -1594,8 +1594,8 @@ scenario editor-moves-to-end-of-line-with-end-2 [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # start on second line (no newline after), press 'end' assume-console [ @@ -1603,9 +1603,9 @@ scenario editor-moves-to-end-of-line-with-end-2 [ press end ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] # cursor moves to end of line memory-should-contain [ @@ -1621,14 +1621,14 @@ scenario editor-deletes-to-start-of-line-with-ctrl-u [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right # start on second line, press ctrl-u assume-console [ left-click 2, 2 press ctrl-u ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # cursor deletes to start of line screen-should-contain [ @@ -1652,7 +1652,7 @@ after <handle-special-character> [ } ] -def delete-to-start-of-line editor:&:editor-data -> result:&:duplex-list:char, editor:&:editor-data [ +def delete-to-start-of-line editor:&:editor -> result:&:duplex-list:char, editor:&:editor [ local-scope load-ingredients # compute range to delete @@ -1684,14 +1684,14 @@ scenario editor-deletes-to-start-of-line-with-ctrl-u-2 [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right # start on first line (no newline before), press ctrl-u assume-console [ left-click 1, 2 press ctrl-u ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # cursor deletes to start of line screen-should-contain [ @@ -1707,14 +1707,14 @@ scenario editor-deletes-to-start-of-line-with-ctrl-u-3 [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right # start past end of line, press ctrl-u assume-console [ left-click 1, 3 press ctrl-u ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # cursor deletes to start of line screen-should-contain [ @@ -1730,14 +1730,14 @@ scenario editor-deletes-to-start-of-final-line-with-ctrl-u [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right # start past end of final line, press ctrl-u assume-console [ left-click 2, 3 press ctrl-u ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # cursor deletes to start of line screen-should-contain [ @@ -1755,14 +1755,14 @@ scenario editor-deletes-to-end-of-line-with-ctrl-k [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right # start on first line, press ctrl-k assume-console [ left-click 1, 1 press ctrl-k ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # cursor deletes to end of line screen-should-contain [ @@ -1786,7 +1786,7 @@ after <handle-special-character> [ } ] -def delete-to-end-of-line editor:&:editor-data -> result:&:duplex-list:char, editor:&:editor-data [ +def delete-to-end-of-line editor:&:editor -> result:&:duplex-list:char, editor:&:editor [ local-scope load-ingredients # compute range to delete @@ -1810,14 +1810,14 @@ scenario editor-deletes-to-end-of-line-with-ctrl-k-2 [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right # start on second line (no newline after), press ctrl-k assume-console [ left-click 2, 1 press ctrl-k ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # cursor deletes to end of line screen-should-contain [ @@ -1833,14 +1833,14 @@ scenario editor-deletes-to-end-of-line-with-ctrl-k-3 [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right # start at end of line assume-console [ left-click 1, 2 press ctrl-k ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # cursor deletes just last character screen-should-contain [ @@ -1856,14 +1856,14 @@ scenario editor-deletes-to-end-of-line-with-ctrl-k-4 [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right # start past end of line assume-console [ left-click 1, 3 press ctrl-k ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # cursor deletes nothing screen-should-contain [ @@ -1879,14 +1879,14 @@ scenario editor-deletes-to-end-of-line-with-ctrl-k-5 [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right # start at end of text assume-console [ left-click 2, 2 press ctrl-k ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # cursor deletes just the final character screen-should-contain [ @@ -1902,14 +1902,14 @@ scenario editor-deletes-to-end-of-line-with-ctrl-k-6 [ assume-screen 10/width, 5/height 1:text <- new [123 456] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right # start past end of text assume-console [ left-click 2, 3 press ctrl-k ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # cursor deletes nothing screen-should-contain [ @@ -1931,7 +1931,7 @@ scenario editor-can-scroll-down-using-arrow-keys [ b c d] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right screen-should-contain [ . . .a . @@ -1944,7 +1944,7 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen slides by one line screen-should-contain [ @@ -2009,7 +2009,7 @@ scenario editor-scrolls-down-past-wrapped-line-using-arrow-keys [ g h i] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right screen-should-contain [ . . .abcd↩ . @@ -2022,7 +2022,7 @@ i] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows partial wrapped line screen-should-contain [ @@ -2041,14 +2041,14 @@ scenario editor-scrolls-down-past-wrapped-line-using-arrow-keys-2 [ k l m] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right # position cursor at last line, then try to move further down assume-console [ left-click 3, 0 press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows partial wrapped line containing a wrap icon screen-should-contain [ @@ -2062,7 +2062,7 @@ m] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows partial wrapped line screen-should-contain [ @@ -2080,16 +2080,16 @@ scenario editor-scrolls-down-when-line-wraps [ 1:text <- new [a b cdef] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right # position cursor at end, type a character assume-console [ left-click 3, 4 type [g] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] # screen scrolls screen-should-contain [ @@ -2110,16 +2110,16 @@ scenario editor-scrolls-down-on-newline [ 1:text <- new [a b c] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right assume-console [ left-click 3, 4 type [ ] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] # screen scrolls screen-should-contain [ @@ -2141,16 +2141,16 @@ scenario editor-scrolls-down-on-right-arrow [ 1:text <- new [a b cdefgh] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right # position cursor at end of screen and try to move right assume-console [ left-click 3, 3 press right-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] # screen scrolls screen-should-contain [ @@ -2173,16 +2173,16 @@ scenario editor-scrolls-down-on-right-arrow-2 [ b c d] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right # position cursor at end of screen and try to move right assume-console [ left-click 3, 3 press right-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] # screen scrolls screen-should-contain [ @@ -2201,8 +2201,8 @@ scenario editor-scrolls-at-end-on-down-arrow [ assume-screen 10/width, 5/height 1:text <- new [abc de] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor $clear-trace # try to move down past end of text assume-console [ @@ -2210,9 +2210,9 @@ de] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] # screen should scroll, moving cursor to end of text memory-should-contain [ @@ -2223,7 +2223,7 @@ de] type [0] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -2238,9 +2238,9 @@ de] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] # screen stops scrolling because cursor is already at top memory-should-contain [ @@ -2252,7 +2252,7 @@ de] type [1] ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -2273,7 +2273,7 @@ d e f g] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right # scroll down one page and one line assume-console [ press page-down @@ -2281,7 +2281,7 @@ g] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen scrolls down 3 lines screen-should-contain [ @@ -2302,7 +2302,7 @@ scenario editor-can-scroll-up-using-arrow-keys [ b c d] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right screen-should-contain [ . . .a . @@ -2315,7 +2315,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen slides by one line screen-should-contain [ @@ -2340,7 +2340,7 @@ after <scroll-up> [ # takes a pointer into the doubly-linked list, scans back to before start of # previous *wrapped* line # beware: never return null pointer -def before-previous-line in:&:duplex-list:char, editor:&:editor-data -> out:&:duplex-list:char [ +def before-previous-line in:&:duplex-list:char, editor:&:editor -> out:&:duplex-list:char [ local-scope load-ingredients curr:&:duplex-list:char <- copy in @@ -2390,7 +2390,7 @@ scenario editor-scrolls-up-past-wrapped-line-using-arrow-keys [ g h i] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right screen-should-contain [ . . .abcd↩ . @@ -2402,7 +2402,7 @@ i] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -2415,7 +2415,7 @@ i] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows partial wrapped line screen-should-contain [ @@ -2434,13 +2434,13 @@ scenario editor-scrolls-up-past-wrapped-line-using-arrow-keys-2 [ k l m] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right # position cursor at top of second page assume-console [ press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -2454,7 +2454,7 @@ m] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows partial wrapped line screen-should-contain [ @@ -2469,7 +2469,7 @@ m] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows partial wrapped line screen-should-contain [ @@ -2484,7 +2484,7 @@ m] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows partial wrapped line screen-should-contain [ @@ -2507,7 +2507,7 @@ scenario editor-scrolls-up-past-wrapped-line-using-arrow-keys-3 [ g h i] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 6/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 6/right screen-should-contain [ . . .abcde↩ . @@ -2519,7 +2519,7 @@ i] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -2532,7 +2532,7 @@ i] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows partial wrapped line screen-should-contain [ @@ -2553,12 +2553,12 @@ b c d e] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 6/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 6/right assume-console [ press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -2570,7 +2570,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -2582,7 +2582,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -2601,13 +2601,13 @@ b c d e] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right # position cursor at top of second page assume-console [ press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -2620,9 +2620,9 @@ e] press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + editor-event-loop screen:&:screen, console:&:console, 2:&:editor + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] # screen scrolls screen-should-contain [ @@ -2645,7 +2645,7 @@ scenario editor-can-scroll-up-to-start-of-file [ b c d] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right screen-should-contain [ . . .a . @@ -2660,7 +2660,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen slides by one line screen-should-contain [ @@ -2674,7 +2674,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen remains unchanged screen-should-contain [ @@ -2693,7 +2693,7 @@ scenario editor-can-scroll [ b c d] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right screen-should-contain [ . . .a . @@ -2705,7 +2705,7 @@ d] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows next page screen-should-contain [ @@ -2750,7 +2750,7 @@ after <handle-special-key> [ # page-down skips entire wrapped lines, so it can't scroll past lines # taking up the entire screen -def page-down editor:&:editor-data -> editor:&:editor-data [ +def page-down editor:&:editor -> editor:&:editor [ local-scope load-ingredients # if editor contents don't overflow screen, do nothing @@ -2778,8 +2778,8 @@ scenario editor-does-not-scroll-past-end [ assume-screen 10/width, 4/height 1:text <- new [a b] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right - editor-render screen, 2:&:editor-data + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right + editor-render screen, 2:&:editor screen-should-contain [ . . .a . @@ -2791,7 +2791,7 @@ b] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen remains unmodified screen-should-contain [ @@ -2810,7 +2810,7 @@ scenario editor-starts-next-page-at-start-of-wrapped-line [ b cdefgh] # editor screen triggers wrap of last line - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 4/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 4/right # some part of last line is not displayed screen-should-contain [ . . @@ -2823,7 +2823,7 @@ cdefgh] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows entire wrapped line screen-should-contain [ @@ -2841,7 +2841,7 @@ scenario editor-starts-next-page-at-start-of-wrapped-line-2 [ # and still has something left over 1:text <- new [a bcdefgh] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 4/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 4/right # some part of last line is not displayed screen-should-contain [ . . @@ -2854,7 +2854,7 @@ bcdefgh] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows entire wrapped line screen-should-contain [ @@ -2873,7 +2873,7 @@ scenario editor-can-scroll-up [ b c d] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right screen-should-contain [ . . .a . @@ -2885,7 +2885,7 @@ d] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows next page screen-should-contain [ @@ -2899,7 +2899,7 @@ d] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows original page again screen-should-contain [ @@ -2943,7 +2943,7 @@ after <handle-special-key> [ } ] -def page-up editor:&:editor-data, screen-height:num -> editor:&:editor-data [ +def page-up editor:&:editor, screen-height:num -> editor:&:editor [ local-scope load-ingredients max:num <- subtract screen-height, 1/menu-bar, 1/overlapping-line @@ -2973,7 +2973,7 @@ e f g h] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 10/right screen-should-contain [ . . .a . @@ -2986,7 +2986,7 @@ h] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows third page screen-should-contain [ @@ -3000,7 +3000,7 @@ h] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows second page screen-should-contain [ @@ -3014,7 +3014,7 @@ h] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows original page again screen-should-contain [ @@ -3040,7 +3040,7 @@ m n o] # editor screen triggers wrap of last line - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 4/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 4/right # some part of last line is not displayed screen-should-contain [ . . @@ -3057,7 +3057,7 @@ o] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows entire wrapped line screen-should-contain [ @@ -3073,7 +3073,7 @@ o] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen resets screen-should-contain [ @@ -3093,7 +3093,7 @@ scenario editor-can-scroll-up-wrapped-lines-2 [ # and still has something left over 1:text <- new [a bcdefgh] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 4/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 4/right # some part of last line is not displayed screen-should-contain [ . . @@ -3106,7 +3106,7 @@ bcdefgh] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen shows entire wrapped line screen-should-contain [ @@ -3120,7 +3120,7 @@ bcdefgh] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] # screen resets screen-should-contain [ @@ -3143,7 +3143,7 @@ fxx gxx hxx ] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 4/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 4/right screen-should-contain [ . . .axx . @@ -3154,7 +3154,7 @@ hxx press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -3166,7 +3166,7 @@ hxx press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -3179,7 +3179,7 @@ hxx press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -3201,7 +3201,7 @@ exy fxy gxy ] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 4/right + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 4/right screen-should-contain [ . . .axy . @@ -3212,7 +3212,7 @@ gxy press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -3224,7 +3224,7 @@ gxy press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . @@ -3237,7 +3237,7 @@ gxy press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data + editor-event-loop screen:&:screen, console:&:console, 2:&:editor ] screen-should-contain [ . . |