diff options
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/001-editor.mu | 36 | ||||
-rw-r--r-- | sandbox/002-typing.mu | 98 | ||||
-rw-r--r-- | sandbox/003-shortcuts.mu | 180 | ||||
-rw-r--r-- | sandbox/004-programming-environment.mu | 2 | ||||
-rw-r--r-- | sandbox/005-sandbox.mu | 62 | ||||
-rw-r--r-- | sandbox/006-sandbox-copy.mu | 14 | ||||
-rw-r--r-- | sandbox/007-sandbox-delete.mu | 20 | ||||
-rw-r--r-- | sandbox/008-sandbox-edit.mu | 18 | ||||
-rw-r--r-- | sandbox/009-sandbox-test.mu | 22 | ||||
-rw-r--r-- | sandbox/010-sandbox-trace.mu | 18 | ||||
-rw-r--r-- | sandbox/011-errors.mu | 138 | ||||
-rw-r--r-- | sandbox/012-editor-undo.mu | 96 |
12 files changed, 352 insertions, 352 deletions
diff --git a/sandbox/001-editor.mu b/sandbox/001-editor.mu index be210b95..f59c43e1 100644 --- a/sandbox/001-editor.mu +++ b/sandbox/001-editor.mu @@ -16,8 +16,8 @@ def! main text:address:array:character [ scenario editor-initially-prints-text-to-screen [ assume-screen 10/width, 5/height run [ - 1:address:array:character <- new [abc] - new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + new-editor 1:text, screen:address:screen, 0/left, 10/right ] screen-should-contain [ # top line of screen reserved for menu @@ -257,9 +257,9 @@ def clear-rest-of-screen screen:address:screen, row:number, left:number, right:n scenario editor-initially-prints-multiple-lines [ assume-screen 5/width, 5/height run [ - s:address:array:character <- new [abc + s:text <- new [abc def] - new-editor s:address:array:character, screen:address:screen, 0/left, 5/right + new-editor s:text, screen:address:screen, 0/left, 5/right ] screen-should-contain [ . . @@ -272,8 +272,8 @@ def] scenario editor-initially-handles-offsets [ assume-screen 5/width, 5/height run [ - s:address:array:character <- new [abc] - new-editor s:address:array:character, screen:address:screen, 1/left, 5/right + s:text <- new [abc] + new-editor s:text, screen:address:screen, 1/left, 5/right ] screen-should-contain [ . . @@ -285,9 +285,9 @@ scenario editor-initially-handles-offsets [ scenario editor-initially-prints-multiple-lines-at-offset [ assume-screen 5/width, 5/height run [ - s:address:array:character <- new [abc + s:text <- new [abc def] - new-editor s:address:array:character, screen:address:screen, 1/left, 5/right + new-editor s:text, screen:address:screen, 1/left, 5/right ] screen-should-contain [ . . @@ -300,8 +300,8 @@ def] scenario editor-initially-wraps-long-lines [ assume-screen 5/width, 5/height run [ - s:address:array:character <- new [abc def] - new-editor s:address:array:character, screen:address:screen, 0/left, 5/right + s:text <- new [abc def] + new-editor s:text, screen:address:screen, 0/left, 5/right ] screen-should-contain [ . . @@ -320,8 +320,8 @@ scenario editor-initially-wraps-long-lines [ scenario editor-initially-wraps-barely-long-lines [ assume-screen 5/width, 5/height run [ - s:address:array:character <- new [abcde] - new-editor s:address:array:character, screen:address:screen, 0/left, 5/right + s:text <- new [abcde] + new-editor s:text, screen:address:screen, 0/left, 5/right ] # still wrap, even though the line would fit. We need room to click on the # end of the line @@ -342,8 +342,8 @@ scenario editor-initially-wraps-barely-long-lines [ scenario editor-initializes-empty-text [ assume-screen 5/width, 5/height run [ - 1:address:array:character <- new [] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 1:text <- new [] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right 3:number <- get *2:address:editor-data, cursor-row:offset 4:number <- get *2:address:editor-data, cursor-column:offset ] @@ -363,10 +363,10 @@ scenario editor-initializes-empty-text [ scenario render-colors-comments [ assume-screen 5/width, 5/height run [ - s:address:array:character <- new [abc + s:text <- new [abc # de f] - new-editor s:address:array:character, screen:address:screen, 0/left, 5/right + new-editor s:text, screen:address:screen, 0/left, 5/right ] screen-should-contain [ . . @@ -444,10 +444,10 @@ def get-color color:number, c:character -> color:number [ scenario render-colors-assignment [ assume-screen 8/width, 5/height run [ - s:address:array:character <- new [abc + s:text <- new [abc d <- e f] - new-editor s:address:array:character, screen:address:screen, 0/left, 8/right + new-editor s:text, screen:address:screen, 0/left, 8/right ] screen-should-contain [ . . diff --git a/sandbox/002-typing.mu b/sandbox/002-typing.mu index 1c4bae8a..b8ca7462 100644 --- a/sandbox/002-typing.mu +++ b/sandbox/002-typing.mu @@ -282,8 +282,8 @@ def editor-render screen:address:screen, editor:address:editor-data -> screen:ad scenario editor-handles-empty-event-queue [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data assume-console [] run [ @@ -299,8 +299,8 @@ scenario editor-handles-empty-event-queue [ scenario editor-handles-mouse-clicks [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -326,8 +326,8 @@ scenario editor-handles-mouse-clicks [ scenario editor-handles-mouse-clicks-outside-text [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right $clear-trace assume-console [ left-click 1, 7 # last line, to the right of text @@ -346,9 +346,9 @@ scenario editor-handles-mouse-clicks-outside-text [ scenario editor-handles-mouse-clicks-outside-text-2 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right $clear-trace assume-console [ left-click 1, 7 # interior line, to the right of text @@ -367,9 +367,9 @@ def] scenario editor-handles-mouse-clicks-outside-text-3 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right $clear-trace assume-console [ left-click 3, 7 # below text @@ -388,9 +388,9 @@ def] scenario editor-handles-mouse-clicks-outside-column [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] + 1:text <- new [abc] # editor occupies only left half of screen - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -417,8 +417,8 @@ scenario editor-handles-mouse-clicks-outside-column [ scenario editor-handles-mouse-clicks-in-menu-area [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -439,8 +439,8 @@ scenario editor-handles-mouse-clicks-in-menu-area [ scenario editor-inserts-characters-into-empty-editor [ assume-screen 10/width, 5/height - 1:address:array:character <- new [] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 1:text <- new [] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -460,8 +460,8 @@ scenario editor-inserts-characters-into-empty-editor [ scenario editor-inserts-characters-at-cursor [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # type two letters at different places @@ -484,8 +484,8 @@ scenario editor-inserts-characters-at-cursor [ scenario editor-inserts-characters-at-cursor-2 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -506,9 +506,9 @@ scenario editor-inserts-characters-at-cursor-2 [ scenario editor-inserts-characters-at-cursor-5 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc d] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -530,8 +530,8 @@ d] scenario editor-inserts-characters-at-cursor-3 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -552,9 +552,9 @@ scenario editor-inserts-characters-at-cursor-3 [ scenario editor-inserts-characters-at-cursor-4 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc d] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -576,9 +576,9 @@ d] scenario editor-inserts-characters-at-cursor-6 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc d] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -600,8 +600,8 @@ d] scenario editor-moves-cursor-after-inserting-characters [ assume-screen 10/width, 5/height - 1:address:array:character <- new [ab] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 1:text <- new [ab] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right editor-render screen, 2:address:editor-data assume-console [ type [01] @@ -621,8 +621,8 @@ scenario editor-moves-cursor-after-inserting-characters [ scenario editor-wraps-line-on-insert [ assume-screen 5/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right editor-render screen, 2:address:editor-data # type a letter assume-console [ @@ -659,9 +659,9 @@ scenario editor-wraps-line-on-insert [ scenario editor-wraps-line-on-insert-2 [ # create an editor with some text assume-screen 10/width, 5/height - 1:address:array:character <- new [abcdefg + 1:text <- new [abcdefg defg] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right editor-render screen, 2:address:editor-data # type more text at the start assume-console [ @@ -740,8 +740,8 @@ after <insert-character-special-case> [ scenario editor-wraps-cursor-after-inserting-characters-in-middle-of-line [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abcde] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 1:text <- new [abcde] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right assume-console [ left-click 1, 3 # right before the wrap icon type [f] @@ -768,7 +768,7 @@ scenario editor-wraps-cursor-after-inserting-characters-at-end-of-line [ local-scope assume-screen 10/width, 5/height # create an editor containing two lines - contents:address:array:character <- new [abc + contents:text <- new [abc xyz] 1:address:editor-data/raw <- new-editor contents, screen, 0/left, 5/right screen-should-contain [ @@ -795,8 +795,8 @@ xyz] scenario editor-wraps-cursor-to-left-margin [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abcde] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 2/left, 7/right + 1:text <- new [abcde] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 2/left, 7/right assume-console [ left-click 1, 5 # line is full; no wrap icon yet type [01] @@ -831,8 +831,8 @@ after <editor-initialization> [ scenario editor-moves-cursor-down-after-inserting-newline [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right assume-console [ type [0 1] @@ -936,8 +936,8 @@ def line-indent curr:address:duplex-list:character, start:address:duplex-list:ch scenario editor-moves-cursor-down-after-inserting-newline-2 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 1/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 1/left, 10/right assume-console [ type [0 1] @@ -956,8 +956,8 @@ scenario editor-moves-cursor-down-after-inserting-newline-2 [ scenario editor-clears-previous-line-completely-after-inserting-newline [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abcde] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 1:text <- new [abcde] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right assume-console [ press enter ] @@ -983,10 +983,10 @@ scenario editor-clears-previous-line-completely-after-inserting-newline [ scenario editor-inserts-indent-after-newline [ assume-screen 10/width, 10/height - 1:address:array:character <- new [ab + 1:text <- new [ab cd ef] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right # position cursor after 'cd' and hit 'newline' assume-console [ left-click 2, 8 @@ -1007,10 +1007,10 @@ ef] scenario editor-skips-indent-around-paste [ assume-screen 10/width, 10/height - 1:address:array:character <- new [ab + 1:text <- new [ab cd ef] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right # position cursor after 'cd' and hit 'newline' surrounded by paste markers assume-console [ left-click 2, 8 diff --git a/sandbox/003-shortcuts.mu b/sandbox/003-shortcuts.mu index 46ab636e..05d42128 100644 --- a/sandbox/003-shortcuts.mu +++ b/sandbox/003-shortcuts.mu @@ -7,9 +7,9 @@ scenario editor-inserts-two-spaces-on-tab [ assume-screen 10/width, 5/height # just one character in final line - 1:address:array:character <- new [ab + 1:text <- new [ab cd] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right assume-console [ press tab ] @@ -40,8 +40,8 @@ after <handle-special-character> [ scenario editor-handles-backspace-key [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -212,9 +212,9 @@ def previous-line-length curr:address:duplex-list:character, start:address:duple scenario editor-clears-last-line-on-backspace [ assume-screen 10/width, 5/height # just one character in final line - 1:address:array:character <- new [ab + 1:text <- new [ab cd] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right assume-console [ left-click 2, 0 # cursor at only character in final line press backspace @@ -239,9 +239,9 @@ cd] scenario editor-joins-and-wraps-lines-on-backspace [ assume-screen 10/width, 5/height # initialize editor with two long-ish but non-wrapping lines - 1:address:array:character <- new [abc def + 1:text <- new [abc def ghi jkl] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # position the cursor at the start of the second and hit backspace @@ -265,8 +265,8 @@ ghi jkl] 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:address:array:character <- new [abc def ghij] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 8/right + 1:text <- new [abc def ghij] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 8/right editor-render screen, 2:address:editor-data # confirm that it wraps screen-should-contain [ @@ -298,8 +298,8 @@ scenario editor-wraps-long-lines-on-backspace [ scenario editor-handles-delete-key [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -387,8 +387,8 @@ def delete-at-cursor editor:address:editor-data, screen:address:screen -> editor scenario editor-moves-cursor-right-with-key [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -482,9 +482,9 @@ def move-cursor-coordinates-right editor:address:editor-data, screen-height:numb scenario editor-moves-cursor-to-next-line-with-right-arrow [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc d] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # type right-arrow a few times to get to start of second line @@ -517,9 +517,9 @@ d] scenario editor-moves-cursor-to-next-line-with-right-arrow-2 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc d] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 1/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 1/left, 10/right editor-render screen, 2:address:editor-data assume-console [ press right-arrow @@ -542,8 +542,8 @@ d] scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abcdef] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 1:text <- new [abcdef] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -572,8 +572,8 @@ scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow [ scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow-2 [ assume-screen 10/width, 5/height # line just barely wrapping - 1:address:array:character <- new [abcde] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 1:text <- new [abcde] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right editor-render screen, 2:address:editor-data $clear-trace # position cursor at last character before wrap and hit right-arrow @@ -608,8 +608,8 @@ 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:address:array:character <- new [abcdef] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 1/left, 6/right + 1:text <- new [abcdef] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 1/left, 6/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -637,9 +637,9 @@ scenario editor-moves-cursor-to-next-wrapped-line-with-right-arrow-3 [ scenario editor-moves-cursor-to-next-line-with-right-arrow-at-end-of-line [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc d] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # move to end of line, press right-arrow, type a character @@ -668,8 +668,8 @@ d] scenario editor-moves-cursor-left-with-key [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -711,9 +711,9 @@ after <handle-special-key> [ scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line [ assume-screen 10/width, 5/height # initialize editor with two lines - 1:address:array:character <- new [abc + 1:text <- new [abc d] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # position cursor at start of second line (so there's no previous newline) @@ -736,10 +736,10 @@ d] scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-2 [ assume-screen 10/width, 5/height # initialize editor with three lines - 1:address:array:character <- new [abc + 1:text <- new [abc def g] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # position cursor further down (so there's a newline before the character at @@ -764,10 +764,10 @@ g] scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-3 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def g] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # position cursor at start of text, press left-arrow, then type a character @@ -793,10 +793,10 @@ g] scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-4 [ assume-screen 10/width, 5/height # initialize editor with text containing an empty line - 1:address:array:character <- new [abc + 1:text <- new [abc d] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # position cursor right after empty line @@ -821,8 +821,8 @@ d] scenario editor-moves-across-screen-lines-across-wrap-with-left-arrow [ assume-screen 10/width, 5/height # initialize editor with a wrapping line - 1:address:array:character <- new [abcdef] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 1:text <- new [abcdef] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right editor-render screen, 2:address:editor-data $clear-trace screen-should-contain [ @@ -852,9 +852,9 @@ scenario editor-moves-across-screen-lines-across-wrap-with-left-arrow [ scenario editor-moves-across-screen-lines-to-wrapping-line-with-left-arrow [ assume-screen 10/width, 5/height # initialize editor with a wrapping line followed by a second line - 1:address:array:character <- new [abcdef + 1:text <- new [abcdef g] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right editor-render screen, 2:address:editor-data $clear-trace screen-should-contain [ @@ -884,9 +884,9 @@ g] scenario editor-moves-across-screen-lines-to-non-wrapping-line-with-left-arrow [ assume-screen 10/width, 5/height # initialize editor with a line on the verge of wrapping, followed by a second line - 1:address:array:character <- new [abcd + 1:text <- new [abcd e] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 5/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right editor-render screen, 2:address:editor-data $clear-trace screen-should-contain [ @@ -919,9 +919,9 @@ e] scenario editor-moves-to-previous-line-with-up-arrow [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -1034,9 +1034,9 @@ def move-to-previous-line editor:address:editor-data -> editor:address:editor-da scenario editor-adjusts-column-at-previous-line [ assume-screen 10/width, 5/height - 1:address:array:character <- new [ab + 1:text <- new [ab def] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -1070,9 +1070,9 @@ def] scenario editor-adjusts-column-at-empty-line [ assume-screen 10/width, 5/height - 1:address:array:character <- new [ + 1:text <- new [ def] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -1107,10 +1107,10 @@ def] scenario editor-moves-to-previous-line-from-left-margin [ assume-screen 10/width, 5/height # start out with three lines - 1:address:array:character <- new [abc + 1:text <- new [abc def ghi] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # click on the third line and hit up-arrow, so you end up just after a newline @@ -1147,9 +1147,9 @@ ghi] scenario editor-moves-to-next-line-with-down-arrow [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # cursor starts out at (1, 0) @@ -1238,9 +1238,9 @@ def move-to-next-line editor:address:editor-data, screen-height:number -> editor scenario editor-adjusts-column-at-next-line [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc de] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace assume-console [ @@ -1276,9 +1276,9 @@ de] scenario editor-moves-to-start-of-line-with-ctrl-a [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # start on second line, press ctrl-a @@ -1351,9 +1351,9 @@ def move-to-start-of-line editor:address:editor-data -> editor:address:editor-da scenario editor-moves-to-start-of-line-with-ctrl-a-2 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # start on first line (no newline before), press ctrl-a @@ -1376,9 +1376,9 @@ scenario editor-moves-to-start-of-line-with-ctrl-a-2 [ scenario editor-moves-to-start-of-line-with-home [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right $clear-trace # start on second line, press 'home' assume-console [ @@ -1400,9 +1400,9 @@ scenario editor-moves-to-start-of-line-with-home [ scenario editor-moves-to-start-of-line-with-home-2 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # start on first line (no newline before), press 'home' @@ -1427,9 +1427,9 @@ scenario editor-moves-to-start-of-line-with-home-2 [ scenario editor-moves-to-end-of-line-with-ctrl-e [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # start on first line, press ctrl-e @@ -1519,9 +1519,9 @@ def move-to-end-of-line editor:address:editor-data -> editor:address:editor-data scenario editor-moves-to-end-of-line-with-ctrl-e-2 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # start on second line (no newline after), press ctrl-e @@ -1544,9 +1544,9 @@ scenario editor-moves-to-end-of-line-with-ctrl-e-2 [ scenario editor-moves-to-end-of-line-with-end [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # start on first line, press 'end' @@ -1569,9 +1569,9 @@ scenario editor-moves-to-end-of-line-with-end [ scenario editor-moves-to-end-of-line-with-end-2 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data $clear-trace # start on second line (no newline after), press 'end' @@ -1596,9 +1596,9 @@ scenario editor-moves-to-end-of-line-with-end-2 [ scenario editor-deletes-to-start-of-line-with-ctrl-u [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right # start on second line, press ctrl-u assume-console [ left-click 2, 2 @@ -1659,9 +1659,9 @@ def delete-to-start-of-line editor:address:editor-data -> result:address:duplex- scenario editor-deletes-to-start-of-line-with-ctrl-u-2 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right # start on first line (no newline before), press ctrl-u assume-console [ left-click 1, 2 @@ -1682,9 +1682,9 @@ scenario editor-deletes-to-start-of-line-with-ctrl-u-2 [ scenario editor-deletes-to-start-of-line-with-ctrl-u-3 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right # start past end of line, press ctrl-u assume-console [ left-click 1, 3 @@ -1705,9 +1705,9 @@ scenario editor-deletes-to-start-of-line-with-ctrl-u-3 [ scenario editor-deletes-to-start-of-final-line-with-ctrl-u [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right # start past end of final line, press ctrl-u assume-console [ left-click 2, 3 @@ -1730,9 +1730,9 @@ scenario editor-deletes-to-start-of-final-line-with-ctrl-u [ scenario editor-deletes-to-end-of-line-with-ctrl-k [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right # start on first line, press ctrl-k assume-console [ left-click 1, 1 @@ -1785,9 +1785,9 @@ def delete-to-end-of-line editor:address:editor-data -> result:address:duplex-li scenario editor-deletes-to-end-of-line-with-ctrl-k-2 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right # start on second line (no newline after), press ctrl-k assume-console [ left-click 2, 1 @@ -1808,9 +1808,9 @@ scenario editor-deletes-to-end-of-line-with-ctrl-k-2 [ scenario editor-deletes-to-end-of-line-with-ctrl-k-3 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right # start at end of line assume-console [ left-click 1, 2 @@ -1831,9 +1831,9 @@ scenario editor-deletes-to-end-of-line-with-ctrl-k-3 [ scenario editor-deletes-to-end-of-line-with-ctrl-k-4 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right # start past end of line assume-console [ left-click 1, 3 @@ -1854,9 +1854,9 @@ scenario editor-deletes-to-end-of-line-with-ctrl-k-4 [ scenario editor-deletes-to-end-of-line-with-ctrl-k-5 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right # start at end of text assume-console [ left-click 2, 2 @@ -1877,9 +1877,9 @@ scenario editor-deletes-to-end-of-line-with-ctrl-k-5 [ scenario editor-deletes-to-end-of-line-with-ctrl-k-6 [ assume-screen 10/width, 5/height - 1:address:array:character <- new [123 + 1:text <- new [123 456] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right # start past end of text assume-console [ left-click 2, 3 diff --git a/sandbox/004-programming-environment.mu b/sandbox/004-programming-environment.mu index b2f0ebc0..bcbc5197 100644 --- a/sandbox/004-programming-environment.mu +++ b/sandbox/004-programming-environment.mu @@ -3,7 +3,7 @@ def! main [ local-scope open-console - initial-sandbox:address:array:character <- new [] + initial-sandbox:text <- new [] hide-screen 0/screen env:address:programming-environment-data <- new-programming-environment 0/screen, initial-sandbox env <- restore-sandboxes env diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu index 54013373..810aab5f 100644 --- a/sandbox/005-sandbox.mu +++ b/sandbox/005-sandbox.mu @@ -32,8 +32,8 @@ scenario run-and-show-results [ trace-until 100/app # trace too long assume-screen 50/width, 15/height # sandbox editor contains an instruction without storing outputs - 1:address:array:character <- new [divide-with-remainder 11, 3] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [divide-with-remainder 11, 3] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text # run the code in the editors assume-console [ press F4 @@ -108,7 +108,7 @@ after <global-keypress> [ do-run?:boolean <- equal k, 65532/F4 break-unless do-run? screen <- update-status screen, [running... ], 245/grey - test-recipes:address:array:character, _/optional <- next-ingredient + test-recipes:text, _/optional <- next-ingredient error?:boolean, env, screen <- run-sandboxes env, screen, test-recipes #? test-recipes <- copy 0 # abandon # F4 might update warnings and results on both sides @@ -130,7 +130,7 @@ def run-sandboxes env:address:programming-environment-data, screen:address:scree <run-sandboxes-begin> current-sandbox:address:editor-data <- get *env, current-sandbox:offset { - sandbox-contents:address:array:character <- editor-contents current-sandbox + sandbox-contents:text <- editor-contents current-sandbox break-unless sandbox-contents # if contents exist, first save them # run them and turn them into a new sandbox-data @@ -171,7 +171,7 @@ def update-recipes env:address:programming-environment-data, screen:address:scre load-ingredients { break-if test-recipes - in:address:array:character <- restore [recipes.mu] # newlayer: persistence + in:text <- restore [recipes.mu] # newlayer: persistence reload in } { @@ -185,8 +185,8 @@ def update-recipes env:address:programming-environment-data, screen:address:scre def! update-sandbox sandbox:address:sandbox-data, env:address:programming-environment-data, idx:number -> sandbox:address:sandbox-data, env:address:programming-environment-data [ local-scope load-ingredients - data:address:array:character <- get *sandbox, data:offset - response:address:array:character, _, fake-screen:address:screen <- run-sandboxed data + data:text <- get *sandbox, data:offset + response:text, _, fake-screen:address:screen <- run-sandboxed data *sandbox <- put *sandbox, response:offset, response *sandbox <- put *sandbox, screen:offset, fake-screen ] @@ -208,8 +208,8 @@ def save-sandboxes env:address:programming-environment-data [ idx:number <- copy 0 { break-unless curr - data:address:array:character <- get *curr, data:offset - filename:address:array:character <- to-text idx + data:text <- get *curr, data:offset + filename:text <- to-text idx save filename, data <end-save-sandbox> idx <- add idx, 1 @@ -262,11 +262,11 @@ def render-sandboxes screen:address:screen, sandbox:address:sandbox-data, left:n # render sandbox contents row <- add row, 1 screen <- move-cursor screen, row, left - sandbox-data:address:array:character <- get *sandbox, data:offset + sandbox-data:text <- get *sandbox, data:offset row, screen <- render-code screen, sandbox-data, left, right, row *sandbox <- put *sandbox, code-ending-row-on-screen:offset, row # render sandbox warnings, screen or response, in that order - sandbox-response:address:array:character <- get *sandbox, response:offset + sandbox-response:text <- get *sandbox, response:offset <render-sandbox-results> { sandbox-screen:address:screen <- get *sandbox, screen:offset @@ -409,8 +409,8 @@ def! restore-sandboxes env:address:programming-environment-data -> env:address:p curr:address:sandbox-data <- copy 0 prev:address:sandbox-data <- copy 0 { - filename:address:array:character <- to-text idx - contents:address:array:character <- restore filename + filename:text <- to-text idx + contents:text <- restore filename break-unless contents # stop at first error; assuming file didn't exist # todo: handle empty sandbox # create new sandbox for file @@ -504,20 +504,20 @@ scenario run-updates-results [ trace-until 100/app # trace too long assume-screen 50/width, 12/height # define a recipe (no indent for the 'add' line below so column numbers are more obvious) - 1:address:array:character <- new [ + 1:text <- new [ def foo [ local-scope z:number <- add 2, 2 return z ]] # sandbox editor contains an instruction without storing outputs - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text # run the code in the editors assume-console [ press F4 ] - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/recipes screen-should-contain [ . run (F4) . . . @@ -529,7 +529,7 @@ return z . . ] # make a change (incrementing one of the args to 'add'), then rerun - 1:address:array:character <- new [ + 1:text <- new [ def foo [ local-scope z:number <- add 2, 3 @@ -539,7 +539,7 @@ return z press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/recipes ] # check that screen updates the result on the right screen-should-contain [ @@ -558,8 +558,8 @@ scenario run-instruction-manages-screen-per-sandbox [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # editor contains an instruction - 1:address:array:character <- new [print-integer screen, 4] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [print-integer screen, 4] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text # run the code in the editor assume-console [ press F4 @@ -606,16 +606,16 @@ def editor-contents editor:address:editor-data -> result:address:array:character scenario editor-provides-edited-contents [ assume-screen 10/width, 5/height - 1:address:array:character <- new [abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right assume-console [ left-click 1, 2 type [def] ] run [ editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data - 3:address:array:character <- editor-contents 2:address:editor-data - 4:array:character <- copy *3:address:array:character + 3:text <- editor-contents 2:address:editor-data + 4:array:character <- copy *3:text ] memory-should-contain [ 4:array:character <- [abdefc] @@ -628,8 +628,8 @@ scenario scrolling-down-past-bottom-of-sandbox-editor [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # initialize - 1:address:array:character <- new [add 2, 2] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [add 2, 2] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text render-all screen, 2:address:programming-environment-data, render assume-console [ # create a sandbox @@ -764,8 +764,8 @@ scenario scrolling-through-multiple-sandboxes [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # initialize environment - 1:address:array:character <- new [] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text render-all screen, 2:address:programming-environment-data, render # create 2 sandboxes assume-console [ @@ -925,8 +925,8 @@ scenario scrolling-manages-sandbox-index-correctly [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # initialize environment - 1:address:array:character <- new [] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text render-all screen, 2:address:programming-environment-data, render # create a sandbox assume-console [ diff --git a/sandbox/006-sandbox-copy.mu b/sandbox/006-sandbox-copy.mu index d1d221d1..754a4a3d 100644 --- a/sandbox/006-sandbox-copy.mu +++ b/sandbox/006-sandbox-copy.mu @@ -4,11 +4,11 @@ scenario copy-a-sandbox-to-editor [ trace-until 50/app # trace too long assume-screen 50/width, 10/height - 1:address:array:character <- new [add 1, 1] + 1:text <- new [add 1, 1] assume-console [ press F4 ] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data screen-should-contain [ . run (F4) . @@ -66,11 +66,11 @@ scenario copy-a-sandbox-to-editor [ scenario copy-a-sandbox-to-editor-2 [ trace-until 50/app # trace too long assume-screen 50/width, 10/height - 1:address:array:character <- new [add 1, 1] + 1:text <- new [add 1, 1] assume-console [ press F4 ] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data screen-should-contain [ . run (F4) . @@ -167,7 +167,7 @@ def try-copy-sandbox click-row:number, env:address:programming-environment-data sandbox:address:sandbox-data <- find-sandbox env, click-row return-unless sandbox, 0/false clicked-on-copy-button? <- copy 1/true - text:address:array:character <- get *sandbox, data:offset + text:text <- get *sandbox, data:offset current-sandbox:address:editor-data <- get *env, current-sandbox:offset current-sandbox <- insert-text current-sandbox, text # reset scroll @@ -217,11 +217,11 @@ def within-range? x:number, low:number, high:number -> result:boolean [ scenario copy-fails-if-sandbox-editor-not-empty [ trace-until 50/app # trace too long assume-screen 50/width, 10/height - 1:address:array:character <- new [add 1, 1] + 1:text <- new [add 1, 1] assume-console [ press F4 ] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data screen-should-contain [ . run (F4) . diff --git a/sandbox/007-sandbox-delete.mu b/sandbox/007-sandbox-delete.mu index 00738646..74a50d3c 100644 --- a/sandbox/007-sandbox-delete.mu +++ b/sandbox/007-sandbox-delete.mu @@ -3,8 +3,8 @@ scenario deleting-sandboxes [ trace-until 100/app # trace too long assume-screen 50/width, 15/height - 1:address:array:character <- new [] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text # run a few commands assume-console [ type [divide-with-remainder 11, 3] @@ -147,8 +147,8 @@ scenario deleting-sandbox-after-scroll [ trace-until 100/app # trace too long assume-screen 50/width, 10/height # initialize environment - 1:address:array:character <- new [] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text render-all screen, 2:address:programming-environment-data, render # create 2 sandboxes and scroll to second assume-console [ @@ -195,8 +195,8 @@ scenario deleting-top-sandbox-after-scroll [ trace-until 100/app # trace too long assume-screen 50/width, 10/height # initialize environment - 1:address:array:character <- new [] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text render-all screen, 2:address:programming-environment-data, render # create 2 sandboxes and scroll to second assume-console [ @@ -243,8 +243,8 @@ scenario deleting-final-sandbox-after-scroll [ trace-until 100/app # trace too long assume-screen 50/width, 10/height # initialize environment - 1:address:array:character <- new [] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text render-all screen, 2:address:programming-environment-data, render # create 2 sandboxes and scroll to second assume-console [ @@ -290,8 +290,8 @@ scenario deleting-updates-sandbox-count [ trace-until 100/app # trace too long assume-screen 50/width, 10/height # initialize environment - 1:address:array:character <- new [] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text render-all screen, 2:address:programming-environment-data, render # create 2 sandboxes assume-console [ diff --git a/sandbox/008-sandbox-edit.mu b/sandbox/008-sandbox-edit.mu index 66aeadc7..c92ec445 100644 --- a/sandbox/008-sandbox-edit.mu +++ b/sandbox/008-sandbox-edit.mu @@ -4,11 +4,11 @@ scenario clicking-on-a-sandbox-moves-it-to-editor [ trace-until 100/app # trace too long assume-screen 50/width, 10/height # run something - 1:address:array:character <- new [add 2, 2] + 1:text <- new [add 2, 2] assume-console [ press F4 ] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data screen-should-contain [ . run (F4) . @@ -92,7 +92,7 @@ def try-edit-sandbox click-row:number, env:address:programming-environment-data return-unless sandbox, 0/false clicked-on-edit-button? <- copy 1/true # 'edit' button = 'copy' button + 'delete' button - text:address:array:character <- get *sandbox, data:offset + text:text <- get *sandbox, data:offset current-sandbox:address:editor-data <- get *env, current-sandbox:offset current-sandbox <- insert-text current-sandbox, text env <- delete-sandbox env, sandbox @@ -104,8 +104,8 @@ scenario sandbox-with-print-can-be-edited [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # run a print instruction - 1:address:array:character <- new [print-integer screen, 4] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [print-integer screen, 4] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text # run the sandbox assume-console [ press F4 @@ -146,8 +146,8 @@ scenario editing-sandbox-after-scrolling-resets-scroll [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # initialize environment - 1:address:array:character <- new [] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text render-all screen, 2:address:programming-environment-data, render # create 2 sandboxes and scroll to second assume-console [ @@ -193,8 +193,8 @@ scenario editing-sandbox-updates-sandbox-count [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # initialize environment - 1:address:array:character <- new [] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text render-all screen, 2:address:programming-environment-data, render # create 2 sandboxes and scroll to second assume-console [ diff --git a/sandbox/009-sandbox-test.mu b/sandbox/009-sandbox-test.mu index 6d0ca691..c89775a4 100644 --- a/sandbox/009-sandbox-test.mu +++ b/sandbox/009-sandbox-test.mu @@ -4,17 +4,17 @@ scenario sandbox-click-on-result-toggles-color-to-green [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # basic recipe - 1:address:array:character <- new [ + 1:text <- new [ def foo [ return 4 ]] # run it - 2:address:array:character <- new [foo] + 2:text <- new [foo] assume-console [ press F4 ] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes screen-should-contain [ . run (F4) . . . @@ -30,7 +30,7 @@ def foo [ left-click 5, 21 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] # color toggles to green screen-should-contain-in-color 2/green, [ @@ -58,7 +58,7 @@ def foo [ . . ] # now change the result - 1:address:array:character <- new [ + 1:text <- new [ def foo [ return 3 ]] @@ -67,7 +67,7 @@ def foo [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/new-test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/new-test-recipes ] # result turns red screen-should-contain-in-color 1/red, [ @@ -90,7 +90,7 @@ container sandbox-data [ # include expected response when saving or restoring a sandbox before <end-save-sandbox> [ { - expected-response:address:array:character <- get *curr, expected-response:offset + expected-response:text <- get *curr, expected-response:offset break-unless expected-response filename <- append filename, [.out] save filename, expected-response @@ -164,7 +164,7 @@ def find-click-in-sandbox-output env:address:programming-environment-data, click def toggle-expected-response sandbox:address:sandbox-data -> sandbox:address:sandbox-data [ local-scope load-ingredients - expected-response:address:array:character <- get *sandbox, expected-response:offset + expected-response:text <- get *sandbox, expected-response:offset { # if expected-response is set, reset break-unless expected-response @@ -173,7 +173,7 @@ def toggle-expected-response sandbox:address:sandbox-data -> sandbox:address:san { # if not, set expected response to the current response break-if expected-response - response:address:array:character <- get *sandbox, response:offset + response:text <- get *sandbox, response:offset *sandbox <- put *sandbox, expected-response:offset, response } ] @@ -183,7 +183,7 @@ after <render-sandbox-response> [ { break-unless sandbox-response *sandbox <- put *sandbox, response-starting-row-on-screen:offset, row - expected-response:address:array:character <- get *sandbox, expected-response:offset + expected-response:text <- get *sandbox, expected-response:offset break-unless expected-response # fall-through to print in grey response-is-expected?:boolean <- equal expected-response, sandbox-response { diff --git a/sandbox/010-sandbox-trace.mu b/sandbox/010-sandbox-trace.mu index 7af6598b..c42a9dfc 100644 --- a/sandbox/010-sandbox-trace.mu +++ b/sandbox/010-sandbox-trace.mu @@ -4,11 +4,11 @@ scenario sandbox-click-on-code-toggles-app-trace [ trace-until 100/app # trace too long assume-screen 50/width, 10/height # run a stash instruction - 1:address:array:character <- new [stash [abc]] + 1:text <- new [stash [abc]] assume-console [ press F4 ] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data screen-should-contain [ . run (F4) . @@ -75,12 +75,12 @@ scenario sandbox-shows-app-trace-and-result [ trace-until 100/app # trace too long assume-screen 50/width, 10/height # run a stash instruction and some code - 1:address:array:character <- new [stash [abc] + 1:text <- new [stash [abc] add 2, 2] assume-console [ press F4 ] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data screen-should-contain [ . run (F4) . @@ -119,12 +119,12 @@ scenario clicking-on-app-trace-does-nothing [ trace-until 100/app # trace too long assume-screen 50/width, 10/height # create and expand the trace - 1:address:array:character <- new [stash 123456789] + 1:text <- new [stash 123456789] assume-console [ press F4 left-click 4, 1 ] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data screen-should-contain [ . run (F4) . @@ -167,8 +167,8 @@ container sandbox-data [ def! update-sandbox sandbox:address:sandbox-data, env:address:programming-environment-data, idx:number -> sandbox:address:sandbox-data, env:address:programming-environment-data [ local-scope load-ingredients - data:address:array:character <- get *sandbox, data:offset - response:address:array:character, _, fake-screen:address:screen, trace:address:array:character <- run-sandboxed data + data:text <- get *sandbox, data:offset + response:text, _, fake-screen:address:screen, trace:text <- run-sandboxed data *sandbox <- put *sandbox, response:offset, response *sandbox <- put *sandbox, screen:offset, fake-screen *sandbox <- put *sandbox, trace:offset, trace @@ -240,7 +240,7 @@ after <render-sandbox-results> [ { display-trace?:boolean <- get *sandbox, display-trace?:offset break-unless display-trace? - sandbox-trace:address:array:character <- get *sandbox, trace:offset + sandbox-trace:text <- get *sandbox, trace:offset break-unless sandbox-trace # nothing to print; move on row, screen <- render-text screen, sandbox-trace, left, right, 245/grey, row } diff --git a/sandbox/011-errors.mu b/sandbox/011-errors.mu index e311cb52..108ec0ab 100644 --- a/sandbox/011-errors.mu +++ b/sandbox/011-errors.mu @@ -11,13 +11,13 @@ def! update-recipes env:address:programming-environment-data, screen:address:scr load-ingredients { break-if test-recipes - in:address:array:character <- restore [recipes.mu] - recipe-errors:address:array:character <- reload in + in:text <- restore [recipes.mu] + recipe-errors:text <- reload in *env <- put *env, recipe-errors:offset, recipe-errors } { break-unless test-recipes - recipe-errors:address:array:character <- reload test-recipes + recipe-errors:text <- reload test-recipes } *env <- put *env, recipe-errors:offset, recipe-errors # if recipe editor has errors, stop @@ -32,7 +32,7 @@ def! update-recipes env:address:programming-environment-data, screen:address:scr before <render-components-end> [ trace 11, [app], [render status] - recipe-errors:address:array:character <- get *env, recipe-errors:offset + recipe-errors:text <- get *env, recipe-errors:offset { break-unless recipe-errors update-status screen, [errors found ], 1/red @@ -66,8 +66,8 @@ before <render-components-end> [ error-index:number <- get *env, error-index:offset sandboxes-completed-successfully?:boolean <- equal error-index, -1 break-if sandboxes-completed-successfully? - error-index-text:address:array:character <- to-text error-index - status:address:array:character <- interpolate [errors found (_) ], error-index-text + error-index-text:text <- to-text error-index + status:text <- interpolate [errors found (_) ], error-index-text update-status screen, status, 1/red } ] @@ -80,13 +80,13 @@ def! update-sandbox sandbox:address:sandbox-data, env:address:programming-enviro local-scope load-ingredients { - recipe-errors:address:array:character <- get *env, recipe-errors:offset + recipe-errors:text <- get *env, recipe-errors:offset break-unless recipe-errors *sandbox <- put *sandbox, errors:offset, recipe-errors return } - data:address:array:character <- get *sandbox, data:offset - response:address:array:character, errors:address:array:character, fake-screen:address:screen, trace:address:array:character, completed?:boolean <- run-sandboxed data + data:text <- get *sandbox, data:offset + response:text, errors:text, fake-screen:address:screen, trace:text, completed?:boolean <- run-sandboxed data *sandbox <- put *sandbox, response:offset, response *sandbox <- put *sandbox, errors:offset, errors *sandbox <- put *sandbox, screen:offset, fake-screen @@ -110,12 +110,12 @@ def! update-sandbox sandbox:address:sandbox-data, env:address:programming-enviro # make sure we render any trace after <render-sandbox-trace-done> [ { - sandbox-errors:address:array:character <- get *sandbox, errors:offset + sandbox-errors:text <- get *sandbox, errors:offset break-unless sandbox-errors *sandbox <- put *sandbox, response-starting-row-on-screen:offset, 0 # no response { break-unless env - recipe-errors:address:array:character <- get *env, recipe-errors:offset + recipe-errors:text <- get *env, recipe-errors:offset row, screen <- render-text screen, recipe-errors, left, right, 1/red, row } row, screen <- render-text screen, sandbox-errors, left, right, 1/red, row @@ -127,17 +127,17 @@ after <render-sandbox-trace-done> [ scenario run-shows-errors-in-get [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [ + 1:text <- new [ def foo [ get 123:number, foo:offset ]] - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] screen-should-contain [ . errors found run (F4) . @@ -158,9 +158,9 @@ def foo [ scenario run-updates-status-with-first-erroneous-sandbox [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [] - 2:address:array:character <- new [] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 1:text <- new [] + 2:text <- new [] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ # create invalid sandbox 1 type [get foo, x:offset] @@ -170,7 +170,7 @@ scenario run-updates-status-with-first-erroneous-sandbox [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/empty-test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/empty-test-recipes ] # status line shows that error is in first sandbox screen-should-contain [ @@ -181,9 +181,9 @@ scenario run-updates-status-with-first-erroneous-sandbox [ scenario run-updates-status-with-first-erroneous-sandbox-2 [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [] - 2:address:array:character <- new [] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 1:text <- new [] + 2:text <- new [] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ # create invalid sandbox 2 type [get foo, x:offset] @@ -196,7 +196,7 @@ scenario run-updates-status-with-first-erroneous-sandbox-2 [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/empty-test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/empty-test-recipes ] # status line shows that error is in second sandbox screen-should-contain [ @@ -207,13 +207,13 @@ scenario run-updates-status-with-first-erroneous-sandbox-2 [ scenario run-hides-errors-from-past-sandboxes [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [] - 2:address:array:character <- new [get foo, x:offset] # invalid - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 1:text <- new [] + 2:text <- new [get foo, x:offset] # invalid + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 # generate error ] - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/empty-test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/empty-test-recipes assume-console [ left-click 3, 10 press ctrl-k @@ -240,18 +240,18 @@ scenario run-updates-errors-for-shape-shifting-recipes [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # define a shape-shifting recipe with an error - 1:address:array:character <- new [recipe foo x:_elem -> z:_elem [ + 1:text <- new [recipe foo x:_elem -> z:_elem [ local-scope load-ingredients y:address:number <- copy 0 z <- add x, y ]] - 2:address:array:character <- new [foo 2] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo 2] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes screen-should-contain [ . errors found (0) run (F4) . . . @@ -268,7 +268,7 @@ z <- add x, y press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] # error should remain unchanged screen-should-contain [ @@ -288,17 +288,17 @@ scenario run-avoids-spurious-errors-on-reloading-shape-shifting-recipes [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # overload a well-known shape-shifting recipe - 1:address:array:character <- new [recipe length l:address:list:_elem -> n:number [ + 1:text <- new [recipe length l:address:list:_elem -> n:number [ ]] # call code that uses other variants of it, but not it itself - 2:address:array:character <- new [x:address:list:number <- copy 0 + 2:text <- new [x:address:list:number <- copy 0 to-text x] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text # run it once assume-console [ press F4 ] - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes # no errors anywhere on screen (can't check anything else, since to-text will return an address) screen-should-contain-in-color 1/red, [ . . @@ -316,7 +316,7 @@ to-text x] press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] # still no errors screen-should-contain-in-color 1/red, [ @@ -335,17 +335,17 @@ to-text x] scenario run-shows-missing-type-errors [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [ + 1:text <- new [ def foo [ x <- copy 0 ]] - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] screen-should-contain [ . errors found run (F4) . @@ -361,17 +361,17 @@ scenario run-shows-unbalanced-bracket-errors [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # recipe is incomplete (unbalanced '[') - 1:address:array:character <- new [ + 1:text <- new [ recipe foo \\[ x <- copy 0 ] - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] screen-should-contain [ . errors found run (F4) . @@ -389,19 +389,19 @@ recipe foo \\[ scenario run-shows-get-on-non-container-errors [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [ + 1:text <- new [ def foo [ local-scope x:address:point <- new point:type get x:address:point, 1:offset ]] - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] screen-should-contain [ . errors found run (F4) . @@ -417,20 +417,20 @@ def foo [ scenario run-shows-non-literal-get-argument-errors [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [ + 1:text <- new [ def foo [ local-scope x:number <- copy 0 y:address:point <- new point:type get *y:address:point, x:number ]] - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] screen-should-contain [ . errors found run (F4) . @@ -447,17 +447,17 @@ scenario run-shows-errors-everytime [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # try to run a file with an error - 1:address:array:character <- new [ + 1:text <- new [ def foo [ local-scope x:number <- copy y:number ]] - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes screen-should-contain [ . errors found run (F4) . . . @@ -471,7 +471,7 @@ def foo [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] screen-should-contain [ . errors found run (F4) . @@ -486,8 +486,8 @@ def foo [ scenario run-instruction-and-print-errors [ trace-until 100/app # trace too long assume-screen 50/width, 15/height - 1:address:array:character <- new [get 1:address:point, 1:offset] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [get 1:address:point, 1:offset] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text assume-console [ press F4 ] @@ -522,8 +522,8 @@ scenario run-instruction-and-print-errors-only-once [ trace-until 100/app # trace too long assume-screen 50/width, 10/height # editor contains an illegal instruction - 1:address:array:character <- new [get 1234:number, foo:offset] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [get 1234:number, foo:offset] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text # run the code in the editors multiple times assume-console [ press F4 @@ -551,10 +551,10 @@ scenario sandbox-can-handle-infinite-loop [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # editor contains an infinite loop - 1:address:array:character <- new [{ + 1:text <- new [{ loop }] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text # run the sandbox assume-console [ press F4 @@ -580,7 +580,7 @@ scenario sandbox-with-errors-shows-trace [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # generate a stash and a error - 1:address:array:character <- new [recipe foo [ + 1:text <- new [recipe foo [ local-scope a:number <- next-ingredient b:number <- next-ingredient @@ -588,13 +588,13 @@ stash [dividing by], b _, c:number <- divide-with-remainder a, b return b ]] - 2:address:array:character <- new [foo 4, 0] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo 4, 0] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text # run assume-console [ press F4 ] - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes # screen prints error message screen-should-contain [ . errors found (0) run (F4) . @@ -612,7 +612,7 @@ return b left-click 4, 15 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] # screen should expand trace screen-should-contain [ diff --git a/sandbox/012-editor-undo.mu b/sandbox/012-editor-undo.mu index 14c156e9..2239560b 100644 --- a/sandbox/012-editor-undo.mu +++ b/sandbox/012-editor-undo.mu @@ -101,8 +101,8 @@ after <handle-special-character> [ scenario editor-can-undo-typing [ # create an editor and type a character assume-screen 10/width, 5/height - 1:address:array:character <- new [] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data assume-console [ type [0] @@ -231,8 +231,8 @@ after <handle-undo> [ scenario editor-can-undo-typing-multiple [ # create an editor and type multiple characters assume-screen 10/width, 5/height - 1:address:array:character <- new [] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data assume-console [ type [012] @@ -257,8 +257,8 @@ scenario editor-can-undo-typing-multiple [ scenario editor-can-undo-typing-multiple-2 [ # create an editor with some text assume-screen 10/width, 5/height - 1:address:array:character <- new [a] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [a] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # type some characters assume-console [ @@ -303,8 +303,8 @@ scenario editor-can-undo-typing-multiple-2 [ scenario editor-can-undo-typing-enter [ # create an editor with some text assume-screen 10/width, 5/height - 1:address:array:character <- new [ abc] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [ abc] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # new line assume-console [ @@ -366,8 +366,8 @@ scenario editor-can-undo-typing-enter [ scenario editor-redo-typing [ # create an editor, type something, undo assume-screen 10/width, 5/height - 1:address:array:character <- new [a] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [a] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data assume-console [ type [012] @@ -430,8 +430,8 @@ after <handle-redo> [ scenario editor-redo-typing-empty [ # create an editor, type something, undo assume-screen 10/width, 5/height - 1:address:array:character <- new [] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data assume-console [ type [012] @@ -476,10 +476,10 @@ scenario editor-redo-typing-empty [ scenario editor-work-clears-redo-stack [ # create an editor with some text, do some work, undo assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def ghi] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data assume-console [ type [1] @@ -518,8 +518,8 @@ ghi] scenario editor-can-redo-typing-and-enter-and-tab [ # create an editor assume-screen 10/width, 5/height - 1:address:array:character <- new [] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # insert some text and tabs, hit enter, some more text and tabs assume-console [ @@ -675,10 +675,10 @@ scenario editor-can-redo-typing-and-enter-and-tab [ scenario editor-can-undo-touch [ # create an editor with some text assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def ghi] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # move the cursor assume-console [ @@ -765,10 +765,10 @@ after <handle-undo> [ scenario editor-can-undo-left-arrow [ # create an editor with some text assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def ghi] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # move the cursor assume-console [ @@ -809,10 +809,10 @@ ghi] scenario editor-can-undo-up-arrow [ # create an editor with some text assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def ghi] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # move the cursor assume-console [ @@ -859,10 +859,10 @@ ghi] scenario editor-can-undo-down-arrow [ # create an editor with some text assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def ghi] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # move the cursor assume-console [ @@ -903,10 +903,10 @@ ghi] scenario editor-can-undo-ctrl-a [ # create an editor with some text assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def ghi] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # move the cursor, then to start of line assume-console [ @@ -947,10 +947,10 @@ ghi] scenario editor-can-undo-home [ # create an editor with some text assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def ghi] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # move the cursor, then to start of line assume-console [ @@ -991,10 +991,10 @@ ghi] scenario editor-can-undo-ctrl-e [ # create an editor with some text assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def ghi] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # move the cursor, then to start of line assume-console [ @@ -1035,10 +1035,10 @@ ghi] scenario editor-can-undo-end [ # create an editor with some text assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def ghi] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # move the cursor, then to start of line assume-console [ @@ -1079,10 +1079,10 @@ ghi] scenario editor-can-undo-multiple-arrows-in-the-same-direction [ # create an editor with some text assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def ghi] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # move the cursor assume-console [ @@ -1133,10 +1133,10 @@ ghi] scenario editor-redo-touch [ # create an editor with some text, click on a character, undo assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def ghi] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data assume-console [ left-click 3, 1 @@ -1190,8 +1190,8 @@ after <handle-redo> [ scenario editor-separates-undo-insert-from-undo-cursor-move [ # create an editor, type some text, move the cursor, type some more text assume-screen 10/width, 5/height - 1:address:array:character <- new [] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data assume-console [ type [abc] @@ -1339,8 +1339,8 @@ scenario editor-separates-undo-insert-from-undo-cursor-move [ scenario editor-can-undo-and-redo-backspace [ # create an editor assume-screen 10/width, 5/height - 1:address:array:character <- new [] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # insert some text and hit backspace assume-console [ @@ -1484,8 +1484,8 @@ after <handle-redo> [ scenario editor-can-undo-and-redo-delete [ # create an editor assume-screen 10/width, 5/height - 1:address:array:character <- new [] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # insert some text and hit delete and backspace a few times assume-console [ @@ -1673,9 +1673,9 @@ before <delete-character-end> [ scenario editor-can-undo-and-redo-ctrl-k [ # create an editor assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # insert some text and hit delete and backspace a few times assume-console [ @@ -1775,9 +1775,9 @@ before <delete-to-end-of-line-end> [ scenario editor-can-undo-and-redo-ctrl-u [ # create an editor assume-screen 10/width, 5/height - 1:address:array:character <- new [abc + 1:text <- new [abc def] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # insert some text and hit delete and backspace a few times assume-console [ @@ -1876,8 +1876,8 @@ before <delete-to-start-of-line-end> [ scenario editor-can-undo-and-redo-ctrl-u-2 [ # create an editor assume-screen 10/width, 5/height - 1:address:array:character <- new [] - 2:address:editor-data <- new-editor 1:address:array:character, screen:address:screen, 0/left, 10/right + 1:text <- new [] + 2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right editor-render screen, 2:address:editor-data # insert some text and hit delete and backspace a few times assume-console [ |