diff options
Diffstat (limited to 'html/edit')
-rw-r--r-- | html/edit/001-editor.mu.html | 40 | ||||
-rw-r--r-- | html/edit/002-typing.mu.html | 270 | ||||
-rw-r--r-- | html/edit/003-shortcuts.mu.html | 787 | ||||
-rw-r--r-- | html/edit/004-programming-environment.mu.html | 89 | ||||
-rw-r--r-- | html/edit/005-sandbox.mu.html | 143 | ||||
-rw-r--r-- | html/edit/006-sandbox-copy.mu.html | 45 | ||||
-rw-r--r-- | html/edit/007-sandbox-delete.mu.html | 76 | ||||
-rw-r--r-- | html/edit/008-sandbox-edit.mu.html | 70 | ||||
-rw-r--r-- | html/edit/009-sandbox-test.mu.html | 20 | ||||
-rw-r--r-- | html/edit/010-sandbox-trace.mu.html | 39 | ||||
-rw-r--r-- | html/edit/011-errors.mu.html | 144 | ||||
-rw-r--r-- | html/edit/012-editor-undo.mu.html | 640 |
12 files changed, 1216 insertions, 1147 deletions
diff --git a/html/edit/001-editor.mu.html b/html/edit/001-editor.mu.html index a5b87d06..38865350 100644 --- a/html/edit/001-editor.mu.html +++ b/html/edit/001-editor.mu.html @@ -15,9 +15,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color * { font-size: 12pt; font-size: 1em; } .muRecipe { color: #ff8700; } .muData { color: #ffff00; } -.Special { color: #c00000; } .muScenario { color: #00af00; } .Delimiter { color: #800080; } +.Special { color: #c00000; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } @@ -49,10 +49,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-initially-prints-text-to-screen [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> run [ - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> ] screen-should-contain [ <span class="Comment"># top line of screen reserved for menu</span> @@ -130,10 +130,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-initializes-without-data [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">3/height</span> run [ - <span class="Constant">1</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">0/data</span>, screen:&:screen, <span class="Constant">2/left</span>, <span class="Constant">5/right</span> - <span class="Constant">2</span>:editor<span class="Special"> <- </span>copy *<span class="Constant">1</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">0/data</span>, screen:&:screen, <span class="Constant">2/left</span>, <span class="Constant">5/right</span> + <span class="Constant">2</span>:editor/<span class="Special">raw <- </span>copy *e ] memory-should-contain [ <span class="Comment"># 2 (data) <- just the § sentinel</span> @@ -290,11 +291,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-initially-prints-multiple-lines [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">5/height</span> run [ s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def]</span> - new-editor s:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -305,10 +307,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-initially-handles-offsets [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">5/height</span> run [ s:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - new-editor s:text, screen:&:screen, <span class="Constant">1/left</span>, <span class="Constant">5/right</span> + new-editor s, screen:&:screen, <span class="Constant">1/left</span>, <span class="Constant">5/right</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -318,11 +321,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-initially-prints-multiple-lines-at-offset [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">5/height</span> run [ s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def]</span> - new-editor s:text, screen:&:screen, <span class="Constant">1/left</span>, <span class="Constant">5/right</span> + new-editor s, screen:&:screen, <span class="Constant">1/left</span>, <span class="Constant">5/right</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -333,10 +337,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-initially-wraps-long-lines [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">5/height</span> run [ s:text<span class="Special"> <- </span>new <span class="Constant">[abc def]</span> - new-editor s:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -353,10 +358,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-initially-wraps-barely-long-lines [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">5/height</span> run [ s:text<span class="Special"> <- </span>new <span class="Constant">[abcde]</span> - new-editor s:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> ] <span class="Comment"># still wrap, even though the line would fit. We need room to click on the</span> <span class="Comment"># end of the line</span> @@ -375,12 +381,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-initializes-empty-text [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">5/height</span> run [ - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -396,12 +402,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># just a little color for mu code</span> <span class="muScenario">scenario</span> render-colors-comments [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">5/height</span> run [ s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant"># de</span> <span class="Constant">f]</span> - new-editor s:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -477,12 +484,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> render-colors-assignment [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">8/width</span>, <span class="Constant">5/height</span> run [ s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">d <- e</span> <span class="Constant">f]</span> - new-editor s:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">8/right</span> + new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">8/right</span> ] screen-should-contain [ <span class="Constant"> . .</span> diff --git a/html/edit/002-typing.mu.html b/html/edit/002-typing.mu.html index 469acd95..3c35ec6f 100644 --- a/html/edit/002-typing.mu.html +++ b/html/edit/002-typing.mu.html @@ -14,13 +14,13 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background- body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.muData { color: #ffff00; } .Special { color: #c00000; } .muScenario { color: #00af00; } .Delimiter { color: #800080; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } +.muData { color: #ffff00; } .muControl { color: #c0a020; } --> </style> @@ -316,13 +316,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-handles-empty-event-queue [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console <span class="Constant">[]</span> run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -333,18 +333,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-handles-mouse-clicks [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">1</span> <span class="Comment"># on the 'b'</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -360,17 +360,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-handles-mouse-clicks-outside-text [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">7</span> <span class="Comment"># last line, to the right of text</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor row</span> @@ -380,18 +380,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-handles-mouse-clicks-outside-text-2 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">7</span> <span class="Comment"># interior line, to the right of text</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor row</span> @@ -401,18 +402,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-handles-mouse-clicks-outside-text-3 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">7</span> <span class="Comment"># below text</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Comment"># cursor row</span> @@ -422,20 +424,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-handles-mouse-clicks-outside-column [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> <span class="Comment"># editor occupies only left half of screen</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ <span class="Comment"># click on right half of screen</span> left-click <span class="Constant">3</span>, <span class="Constant">8</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -451,19 +453,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-handles-mouse-clicks-in-menu-area [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ <span class="Comment"># click on first, 'menu' row</span> left-click <span class="Constant">0</span>, <span class="Constant">3</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># no change to cursor</span> memory-should-contain [ @@ -473,16 +475,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-inserts-characters-into-empty-editor [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ - type <span class="Constant">[abc]</span> + <span class="muData">type</span> <span class="Constant">[abc]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -494,19 +496,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-inserts-characters-at-cursor [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># type two letters at different places</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> left-click <span class="Constant">1</span>, <span class="Constant">2</span> - type <span class="Constant">[d]</span> + <span class="muData">type</span> <span class="Constant">[d]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -518,17 +520,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-inserts-characters-at-cursor-2 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">5</span> <span class="Comment"># right of last line</span> - type <span class="Constant">[d]</span> + <span class="muData">type</span> <span class="Constant">[d]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -540,18 +542,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-inserts-characters-at-cursor-5 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">5</span> <span class="Comment"># right of non-last line</span> - type <span class="Constant">[e]</span> + <span class="muData">type</span> <span class="Constant">[e]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -564,17 +567,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-inserts-characters-at-cursor-3 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">5</span> <span class="Comment"># below all text</span> - type <span class="Constant">[d]</span> + <span class="muData">type</span> <span class="Constant">[d]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -586,18 +589,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-inserts-characters-at-cursor-4 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">5</span> <span class="Comment"># below all text</span> - type <span class="Constant">[e]</span> + <span class="muData">type</span> <span class="Constant">[e]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -610,18 +614,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-inserts-characters-at-cursor-6 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">5</span> <span class="Comment"># below all text</span> - type <span class="Constant">[ef]</span> + <span class="muData">type</span> <span class="Constant">[ef]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -634,15 +639,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-after-inserting-characters [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ab]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[ab]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[01]</span> + <span class="muData">type</span> <span class="Constant">[01]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -655,16 +660,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># if the cursor reaches the right margin, wrap the line</span> <span class="muScenario">scenario</span> editor-wraps-line-on-insert [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + editor-render screen, e <span class="Comment"># type a letter</span> assume-console [ - type <span class="Constant">[e]</span> + <span class="muData">type</span> <span class="Constant">[e]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># no wrap yet</span> screen-should-contain [ @@ -676,10 +681,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># type a second letter</span> assume-console [ - type <span class="Constant">[f]</span> + <span class="muData">type</span> <span class="Constant">[f]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># now wrap</span> screen-should-contain [ @@ -692,21 +697,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-wraps-line-on-insert-2 [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcdefg</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abcdefg</span> <span class="Constant">defg]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + editor-render screen, e <span class="Comment"># type more text at the start</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">0</span> - type <span class="Constant">[abc]</span> + <span class="muData">type</span> <span class="Constant">[abc]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor is not wrapped</span> memory-should-contain [ @@ -775,17 +781,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-wraps-cursor-after-inserting-characters-in-middle-of-line [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcde]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abcde]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">3</span> <span class="Comment"># right before the wrap icon</span> - type <span class="Constant">[f]</span> + <span class="muData">type</span> <span class="Constant">[f]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -804,9 +810,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># create an editor containing two lines</span> - contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">xyz]</span> - <span class="Constant">1</span>:&:editor/<span class="Special">raw <- </span>new-editor contents, screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .abc .</span> @@ -815,10 +821,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">4</span> <span class="Comment"># at end of first line</span> - type <span class="Constant">[de]</span> <span class="Comment"># trigger wrap</span> + <span class="muData">type</span> <span class="Constant">[de]</span> <span class="Comment"># trigger wrap</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">1</span>:&:editor/<span class="Special">raw</span> + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -830,17 +836,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-wraps-cursor-to-left-margin [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcde]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">2/left</span>, <span class="Constant">7/right</span> + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abcde]</span>, screen:&:screen, <span class="Constant">2/left</span>, <span class="Constant">7/right</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">5</span> <span class="Comment"># line is full; no wrap icon yet</span> - type <span class="Constant">[01]</span> + <span class="muData">type</span> <span class="Constant">[01]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -866,15 +872,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-down-after-inserting-newline [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> assume-console [ - type <span class="Constant">[0</span> + <span class="muData">type</span> <span class="Constant">[0</span> <span class="Constant">1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -972,15 +978,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-down-after-inserting-newline-2 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">1/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">1/left</span>, <span class="Constant">10/right</span> assume-console [ - type <span class="Constant">[0</span> + <span class="muData">type</span> <span class="Constant">[0</span> <span class="Constant">1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -992,9 +998,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-clears-previous-line-completely-after-inserting-newline [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcde]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abcde]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> assume-console [ press enter ] @@ -1006,7 +1012,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . .</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># line should be fully cleared</span> screen-should-contain [ @@ -1019,21 +1025,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-inserts-indent-after-newline [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">10/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ab</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[ab</span> <span class="Constant"> cd</span> <span class="Constant">ef]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Comment"># position cursor after 'cd' and hit 'newline'</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">8</span> - type [ + <span class="muData">type</span> [ ] ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor should be below start of previous line</span> memory-should-contain [ @@ -1043,11 +1050,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-skips-indent-around-paste [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">10/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ab</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[ab</span> <span class="Constant"> cd</span> <span class="Constant">ef]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Comment"># position cursor after 'cd' and hit 'newline' surrounded by paste markers</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">8</span> @@ -1056,9 +1064,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press <span class="Constant">65506</span> <span class="Comment"># end paste</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor should be below start of previous line</span> memory-should-contain [ diff --git a/html/edit/003-shortcuts.mu.html b/html/edit/003-shortcuts.mu.html index 8a6f0fbc..e3085a78 100644 --- a/html/edit/003-shortcuts.mu.html +++ b/html/edit/003-shortcuts.mu.html @@ -20,6 +20,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } +.muData { color: #ffff00; } .muControl { color: #c0a020; } --> </style> @@ -39,16 +40,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># tab - insert two spaces</span> <span class="muScenario">scenario</span> editor-inserts-two-spaces-on-tab [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># just one character in final line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ab</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[ab</span> <span class="Constant">cd]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> assume-console [ press tab ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -73,19 +75,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># backspace - delete character before cursor</span> <span class="muScenario">scenario</span> editor-handles-backspace-key [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">1</span> press backspace ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">5</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -250,19 +252,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-clears-last-line-on-backspace [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># just one character in final line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ab</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[ab</span> <span class="Constant">cd]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">0</span> <span class="Comment"># cursor at only character in final line</span> press backspace ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">5</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -277,12 +280,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-joins-and-wraps-lines-on-backspace [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize editor with two long-ish but non-wrapping lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc def</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc def</span> <span class="Constant">ghi jkl]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># position the cursor at the start of the second and hit backspace</span> assume-console [ @@ -290,7 +294,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press backspace ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># resulting single line should wrap correctly</span> screen-should-contain [ @@ -303,11 +307,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-wraps-long-lines-on-backspace [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize editor in part of the screen with a long line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc def ghij]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">8/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc def ghij]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">8/right</span> + editor-render screen, e <span class="Comment"># confirm that it wraps</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -322,7 +326,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press backspace ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># resulting single line should wrap correctly and not overflow its bounds</span> screen-should-contain [ @@ -337,16 +341,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># delete - delete character at cursor</span> <span class="muScenario">scenario</span> editor-handles-delete-key [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ press delete ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -360,7 +364,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press delete ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -426,17 +430,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># right arrow</span> <span class="muScenario">scenario</span> editor-moves-cursor-right-with-key [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ press right-arrow - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -523,11 +527,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-to-next-line-with-right-arrow [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># type right-arrow a few times to get to start of second line</span> assume-console [ @@ -537,15 +542,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press right-arrow <span class="Comment"># next line</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] check-trace-count-for-label <span class="Constant">0</span>, <span class="Constant">[print-character]</span> <span class="Comment"># type something and ensure it goes where it should</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -558,20 +563,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-to-next-line-with-right-arrow-2 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">1/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">1/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ press right-arrow press right-arrow press right-arrow press right-arrow <span class="Comment"># next line</span> - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -583,19 +589,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-to-next-wrapped-line-with-right-arrow [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcdef]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abcdef]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">3</span> press right-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -612,11 +618,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-to-next-wrapped-line-with-right-arrow-2 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># line just barely wrapping</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcde]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abcde]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># position cursor at last character before wrap and hit right-arrow</span> assume-console [ @@ -624,9 +630,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press right-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -637,9 +643,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press right-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -649,19 +655,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-to-next-wrapped-line-with-right-arrow-3 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcdef]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">1/left</span>, <span class="Constant">6/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abcdef]</span>, screen:&:screen, <span class="Constant">1/left</span>, <span class="Constant">6/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">4</span> press right-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -678,20 +684,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-to-next-line-with-right-arrow-at-end-of-line [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># move to end of line, press right-arrow, type a character</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">3</span> press right-arrow - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># new character should be in next line</span> screen-should-contain [ @@ -709,18 +716,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># left arrow</span> <span class="muScenario">scenario</span> editor-moves-cursor-left-with-key [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">2</span> press left-arrow - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -751,12 +758,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize editor with two lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># position cursor at start of second line (so there's no previous newline)</span> assume-console [ @@ -764,9 +772,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -776,23 +784,24 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-2 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize editor with three lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">g]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># position cursor further down (so there's a newline before the character at</span> <span class="Comment"># the cursor)</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">0</span> press left-arrow - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -805,21 +814,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-3 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">g]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># position cursor at start of text, press left-arrow, then type a character</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">0</span> press left-arrow - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># left-arrow should have had no effect</span> screen-should-contain [ @@ -833,22 +843,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-4 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize editor with text containing an empty line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> d] - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e:&:editor <span class="Constant"> $clear-trace</span> <span class="Comment"># position cursor right after empty line</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">0</span> press left-arrow - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -861,11 +872,11 @@ d] ] <span class="muScenario">scenario</span> editor-moves-across-screen-lines-across-wrap-with-left-arrow [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize editor with a wrapping line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcdef]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abcdef]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -880,9 +891,9 @@ d] press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># previous row</span> @@ -892,12 +903,13 @@ d] ] <span class="muScenario">scenario</span> editor-moves-across-screen-lines-to-wrapping-line-with-left-arrow [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize editor with a wrapping line followed by a second line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcdef</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abcdef</span> <span class="Constant">g]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -912,9 +924,9 @@ d] press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Comment"># previous row</span> @@ -924,12 +936,13 @@ d] ] <span class="muScenario">scenario</span> editor-moves-across-screen-lines-to-non-wrapping-line-with-left-arrow [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize editor with a line on the verge of wrapping, followed by a second line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcd</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abcd</span> <span class="Constant">e]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -944,9 +957,9 @@ d] press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># previous row</span> @@ -960,20 +973,21 @@ d] <span class="Comment"># up arrow</span> <span class="muScenario">scenario</span> editor-moves-to-previous-line-with-up-arrow [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -981,10 +995,10 @@ d] ] check-trace-count-for-label <span class="Constant">0</span>, <span class="Constant">[print-character]</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1076,20 +1090,21 @@ d] ] <span class="muScenario">scenario</span> editor-adjusts-column-at-previous-line [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ab</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[ab</span> <span class="Constant">def]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">3</span> press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1097,10 +1112,10 @@ d] ] check-trace-count-for-label <span class="Constant">0</span>, <span class="Constant">[print-character]</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1112,20 +1127,21 @@ d] ] <span class="muScenario">scenario</span> editor-adjusts-column-at-empty-line [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new [ + s:text<span class="Special"> <- </span>new [ <span class="muRecipe">def</span>] - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">3</span> press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1133,10 +1149,10 @@ d] ] check-trace-count-for-label <span class="Constant">0</span>, <span class="Constant">[print-character]</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1148,13 +1164,14 @@ d] ] <span class="muScenario">scenario</span> editor-moves-to-previous-line-from-left-margin [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># start out with three lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># click on the third line and hit up-arrow, so you end up just after a newline</span> assume-console [ @@ -1162,9 +1179,9 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -1172,10 +1189,10 @@ d] ] check-trace-count-for-label <span class="Constant">0</span>, <span class="Constant">[print-character]</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1189,20 +1206,21 @@ d] <span class="Comment"># down arrow</span> <span class="muScenario">scenario</span> editor-moves-to-next-line-with-down-arrow [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># cursor starts out at (1, 0)</span> assume-console [ press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># ..and ends at (2, 0)</span> memory-should-contain [ @@ -1211,10 +1229,10 @@ d] ] check-trace-count-for-label <span class="Constant">0</span>, <span class="Constant">[print-character]</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1294,20 +1312,21 @@ d] ] <span class="muScenario">scenario</span> editor-adjusts-column-at-next-line [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">de]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">3</span> press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -1315,10 +1334,10 @@ d] ] check-trace-count-for-label <span class="Constant">0</span>, <span class="Constant">[print-character]</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1332,11 +1351,12 @@ d] <span class="Comment"># ctrl-a/home - move cursor to start of line</span> <span class="muScenario">scenario</span> editor-moves-to-start-of-line-with-ctrl-a [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># start on second line, press ctrl-a</span> assume-console [ @@ -1344,9 +1364,9 @@ d] press ctrl-a ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">5</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor moves to start of line</span> memory-should-contain [ @@ -1407,11 +1427,12 @@ d] ] <span class="muScenario">scenario</span> editor-moves-to-start-of-line-with-ctrl-a-2 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># start on first line (no newline before), press ctrl-a</span> assume-console [ @@ -1419,9 +1440,9 @@ d] press ctrl-a ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">5</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor moves to start of line</span> memory-should-contain [ @@ -1432,10 +1453,11 @@ d] ] <span class="muScenario">scenario</span> editor-moves-to-start-of-line-with-home [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Constant"> $clear-trace</span> <span class="Comment"># start on second line, press 'home'</span> assume-console [ @@ -1443,9 +1465,9 @@ d] press home ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor moves to start of line</span> memory-should-contain [ @@ -1456,11 +1478,12 @@ d] ] <span class="muScenario">scenario</span> editor-moves-to-start-of-line-with-home-2 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># start on first line (no newline before), press 'home'</span> assume-console [ @@ -1468,9 +1491,9 @@ d] press home ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor moves to start of line</span> memory-should-contain [ @@ -1483,11 +1506,12 @@ d] <span class="Comment"># ctrl-e/end - move cursor to end of line</span> <span class="muScenario">scenario</span> editor-moves-to-end-of-line-with-ctrl-e [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># start on first line, press ctrl-e</span> assume-console [ @@ -1495,9 +1519,9 @@ d] press ctrl-e ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">5</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor moves to end of line</span> memory-should-contain [ @@ -1507,12 +1531,12 @@ d] check-trace-count-for-label <span class="Constant">0</span>, <span class="Constant">[print-character]</span> <span class="Comment"># editor inserts future characters at cursor</span> assume-console [ - type <span class="Constant">[z]</span> + <span class="muData">type</span> <span class="Constant">[z]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">5</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1575,11 +1599,12 @@ d] ] <span class="muScenario">scenario</span> editor-moves-to-end-of-line-with-ctrl-e-2 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># start on second line (no newline after), press ctrl-e</span> assume-console [ @@ -1587,9 +1612,9 @@ d] press ctrl-e ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">5</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor moves to end of line</span> memory-should-contain [ @@ -1600,11 +1625,12 @@ d] ] <span class="muScenario">scenario</span> editor-moves-to-end-of-line-with-end [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># start on first line, press 'end'</span> assume-console [ @@ -1612,9 +1638,9 @@ d] press end ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor moves to end of line</span> memory-should-contain [ @@ -1625,11 +1651,12 @@ d] ] <span class="muScenario">scenario</span> editor-moves-to-end-of-line-with-end-2 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># start on second line (no newline after), press 'end'</span> assume-console [ @@ -1637,9 +1664,9 @@ d] press end ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor moves to end of line</span> memory-should-contain [ @@ -1652,17 +1679,18 @@ d] <span class="Comment"># ctrl-u - delete text from start of line until (but not at) cursor</span> <span class="muScenario">scenario</span> editor-deletes-to-start-of-line-with-ctrl-u [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Comment"># start on second line, press ctrl-u</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">2</span> press ctrl-u ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor deletes to start of line</span> screen-should-contain [ @@ -1715,17 +1743,18 @@ d] ] <span class="muScenario">scenario</span> editor-deletes-to-start-of-line-with-ctrl-u-2 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Comment"># start on first line (no newline before), press ctrl-u</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">2</span> press ctrl-u ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor deletes to start of line</span> screen-should-contain [ @@ -1738,17 +1767,18 @@ d] ] <span class="muScenario">scenario</span> editor-deletes-to-start-of-line-with-ctrl-u-3 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Comment"># start past end of line, press ctrl-u</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">3</span> press ctrl-u ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor deletes to start of line</span> screen-should-contain [ @@ -1761,17 +1791,18 @@ d] ] <span class="muScenario">scenario</span> editor-deletes-to-start-of-final-line-with-ctrl-u [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Comment"># start past end of final line, press ctrl-u</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">3</span> press ctrl-u ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor deletes to start of line</span> screen-should-contain [ @@ -1786,17 +1817,18 @@ d] <span class="Comment"># ctrl-k - delete text from cursor to end of line (but not the newline)</span> <span class="muScenario">scenario</span> editor-deletes-to-end-of-line-with-ctrl-k [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Comment"># start on first line, press ctrl-k</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">1</span> press ctrl-k ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor deletes to end of line</span> screen-should-contain [ @@ -1841,17 +1873,18 @@ d] ] <span class="muScenario">scenario</span> editor-deletes-to-end-of-line-with-ctrl-k-2 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Comment"># start on second line (no newline after), press ctrl-k</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> press ctrl-k ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor deletes to end of line</span> screen-should-contain [ @@ -1864,17 +1897,18 @@ d] ] <span class="muScenario">scenario</span> editor-deletes-to-end-of-line-with-ctrl-k-3 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Comment"># start at end of line</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">2</span> press ctrl-k ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor deletes just last character</span> screen-should-contain [ @@ -1887,17 +1921,18 @@ d] ] <span class="muScenario">scenario</span> editor-deletes-to-end-of-line-with-ctrl-k-4 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Comment"># start past end of line</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">3</span> press ctrl-k ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor deletes nothing</span> screen-should-contain [ @@ -1910,17 +1945,18 @@ d] ] <span class="muScenario">scenario</span> editor-deletes-to-end-of-line-with-ctrl-k-5 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Comment"># start at end of text</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">2</span> press ctrl-k ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor deletes just the final character</span> screen-should-contain [ @@ -1933,17 +1969,18 @@ d] ] <span class="muScenario">scenario</span> editor-deletes-to-end-of-line-with-ctrl-k-6 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[123</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[123</span> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> <span class="Comment"># start past end of text</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">3</span> press ctrl-k ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor deletes nothing</span> screen-should-contain [ @@ -1958,14 +1995,15 @@ d] <span class="Comment"># cursor-down can scroll if necessary</span> <span class="muScenario">scenario</span> editor-can-scroll-down-using-arrow-keys [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># initialize editor with >3 lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -1978,7 +2016,7 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen slides by one line</span> screen-should-contain [ @@ -2035,15 +2073,16 @@ d] ] <span class="muScenario">scenario</span> editor-scrolls-down-past-wrapped-line-using-arrow-keys [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># initialize editor with a long, wrapped line and more than a screen of</span> <span class="Comment"># other lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcdef</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abcdef</span> <span class="Constant">g</span> <span class="Constant">h</span> <span class="Constant">i]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .abcd↩ .</span> @@ -2056,7 +2095,7 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2068,21 +2107,22 @@ d] ] <span class="muScenario">scenario</span> editor-scrolls-down-past-wrapped-line-using-arrow-keys-2 [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># editor starts with a long line wrapping twice</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcdefghij</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abcdefghij</span> <span class="Constant">k</span> <span class="Constant">l</span> <span class="Constant">m]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> <span class="Comment"># position cursor at last line, then try to move further down</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">0</span> press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows partial wrapped line containing a wrap icon</span> screen-should-contain [ @@ -2096,7 +2136,7 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2108,22 +2148,23 @@ d] ] <span class="muScenario">scenario</span> editor-scrolls-down-when-line-wraps [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">4/height</span> <span class="Comment"># editor contains a long line in the third line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">cdef]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> <span class="Comment"># position cursor at end, type a character</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">4</span> - type <span class="Constant">[g]</span> + <span class="muData">type</span> <span class="Constant">[g]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># screen scrolls</span> screen-should-contain [ @@ -2139,21 +2180,22 @@ d] ] <span class="muScenario">scenario</span> editor-scrolls-down-on-newline [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">4/height</span> <span class="Comment"># position cursor after last line and type newline</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">4</span> - type [ + <span class="muData">type</span> [ ] ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># screen scrolls</span> screen-should-contain [ @@ -2169,22 +2211,23 @@ d] ] <span class="muScenario">scenario</span> editor-scrolls-down-on-right-arrow [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">4/height</span> <span class="Comment"># editor contains a wrapped line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">cdefgh]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> <span class="Comment"># position cursor at end of screen and try to move right</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">3</span> press right-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># screen scrolls</span> screen-should-contain [ @@ -2200,23 +2243,24 @@ d] ] <span class="muScenario">scenario</span> editor-scrolls-down-on-right-arrow-2 [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">4/height</span> <span class="Comment"># editor contains more lines than can fit on screen</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> <span class="Comment"># position cursor at end of screen and try to move right</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">3</span> press right-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># screen scrolls</span> screen-should-contain [ @@ -2232,11 +2276,12 @@ d] ] <span class="muScenario">scenario</span> editor-scrolls-at-end-on-down-arrow [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">de]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Constant"> $clear-trace</span> <span class="Comment"># try to move down past end of text</span> assume-console [ @@ -2244,9 +2289,9 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># screen should scroll, moving cursor to end of text</span> memory-should-contain [ @@ -2254,10 +2299,10 @@ d] <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> ] assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2272,9 +2317,9 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># screen stops scrolling because cursor is already at top</span> memory-should-contain [ @@ -2283,10 +2328,10 @@ d] ] check-trace-count-for-label <span class="Constant">0</span>, <span class="Constant">[print-character]</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2297,17 +2342,18 @@ d] ] <span class="muScenario">scenario</span> editor-combines-page-and-line-scroll [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># initialize editor with a few pages of lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f</span> <span class="Constant">g]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> <span class="Comment"># scroll down one page and one line</span> assume-console [ press page-down @@ -2315,7 +2361,7 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen scrolls down 3 lines</span> screen-should-contain [ @@ -2329,14 +2375,15 @@ d] <span class="Comment"># cursor-up can scroll if necessary</span> <span class="muScenario">scenario</span> editor-can-scroll-up-using-arrow-keys [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># initialize editor with >3 lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -2349,7 +2396,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen slides by one line</span> screen-should-contain [ @@ -2416,15 +2463,16 @@ d] ] <span class="muScenario">scenario</span> editor-scrolls-up-past-wrapped-line-using-arrow-keys [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># initialize editor with a long, wrapped line and more than a screen of</span> <span class="Comment"># other lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcdef</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abcdef</span> <span class="Constant">g</span> <span class="Constant">h</span> <span class="Constant">i]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .abcd↩ .</span> @@ -2436,7 +2484,7 @@ d] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2449,7 +2497,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2461,20 +2509,21 @@ d] ] <span class="muScenario">scenario</span> editor-scrolls-up-past-wrapped-line-using-arrow-keys-2 [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 4 lines</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span class="Comment"># editor starts with a long line wrapping twice, occupying 3 of the 4 lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcdefghij</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abcdefghij</span> <span class="Constant">k</span> <span class="Constant">l</span> <span class="Constant">m]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> <span class="Comment"># position cursor at top of second page</span> assume-console [ press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2488,7 +2537,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2503,7 +2552,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2518,7 +2567,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2533,15 +2582,16 @@ d] <span class="Comment"># same as editor-scrolls-up-past-wrapped-line-using-arrow-keys but length</span> <span class="Comment"># slightly off, just to prevent over-training</span> <span class="muScenario">scenario</span> editor-scrolls-up-past-wrapped-line-using-arrow-keys-3 [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># initialize editor with a long, wrapped line and more than a screen of</span> <span class="Comment"># other lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abcdef</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abcdef</span> <span class="Constant">g</span> <span class="Constant">h</span> <span class="Constant">i]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">6/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">6/right</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .abcde↩ .</span> @@ -2553,7 +2603,7 @@ d] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2566,7 +2616,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2579,20 +2629,21 @@ d] <span class="Comment"># check empty lines</span> <span class="muScenario">scenario</span> editor-scrolls-up-past-wrapped-line-using-arrow-keys-4 [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># initialize editor with some lines around an empty line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> c d e] - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">6/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">6/right</span> assume-console [ press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2604,7 +2655,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2616,7 +2667,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2627,21 +2678,22 @@ e] ] <span class="muScenario">scenario</span> editor-scrolls-up-on-left-arrow [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">4/height</span> <span class="Comment"># editor contains >3 lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d</span> <span class="Constant">e]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> <span class="Comment"># position cursor at top of second page</span> assume-console [ press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2654,9 +2706,9 @@ e] press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># screen scrolls</span> screen-should-contain [ @@ -2672,14 +2724,15 @@ e] ] <span class="muScenario">scenario</span> editor-can-scroll-up-to-start-of-file [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># initialize editor with >3 lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -2694,7 +2747,7 @@ e] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen slides by one line</span> screen-should-contain [ @@ -2708,7 +2761,7 @@ e] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen remains unchanged</span> screen-should-contain [ @@ -2722,12 +2775,13 @@ e] <span class="Comment"># ctrl-f/page-down - render next page if it exists</span> <span class="muScenario">scenario</span> editor-can-scroll [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -2739,7 +2793,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows next page</span> screen-should-contain [ @@ -2809,11 +2863,12 @@ e] ] <span class="muScenario">scenario</span> editor-does-not-scroll-past-end [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -2825,7 +2880,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen remains unmodified</span> screen-should-contain [ @@ -2837,14 +2892,15 @@ e] ] <span class="muScenario">scenario</span> editor-starts-next-page-at-start-of-wrapped-line [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines for text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># editor contains a long last line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">cdefgh]</span> <span class="Comment"># editor screen triggers wrap of last line</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">4/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">4/right</span> <span class="Comment"># some part of last line is not displayed</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -2857,7 +2913,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows entire wrapped line</span> screen-should-contain [ @@ -2869,13 +2925,14 @@ e] ] <span class="muScenario">scenario</span> editor-starts-next-page-at-start-of-wrapped-line-2 [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines for text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># editor contains a very long line that occupies last two lines of screen</span> <span class="Comment"># and still has something left over</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">bcdefgh]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">4/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">4/right</span> <span class="Comment"># some part of last line is not displayed</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -2888,7 +2945,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows entire wrapped line</span> screen-should-contain [ @@ -2902,12 +2959,13 @@ e] <span class="Comment"># ctrl-b/page-up - render previous page if it exists</span> <span class="muScenario">scenario</span> editor-can-scroll-up [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -2919,7 +2977,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows next page</span> screen-should-contain [ @@ -2933,7 +2991,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows original page again</span> screen-should-contain [ @@ -2996,10 +3054,11 @@ e] ] <span class="muScenario">scenario</span> editor-can-scroll-up-multiple-pages [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># initialize editor with 8 lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d</span> @@ -3007,7 +3066,7 @@ e] <span class="Constant">f</span> <span class="Constant">g</span> <span class="Constant">h]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -3020,7 +3079,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows third page</span> screen-should-contain [ @@ -3034,7 +3093,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows second page</span> screen-should-contain [ @@ -3048,7 +3107,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows original page again</span> screen-should-contain [ @@ -3060,10 +3119,11 @@ e] ] <span class="muScenario">scenario</span> editor-can-scroll-up-wrapped-lines [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 5 lines for text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">6/height</span> <span class="Comment"># editor contains a long line in the first page</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">cdefgh</span> <span class="Constant">i</span> @@ -3074,7 +3134,7 @@ e] <span class="Constant">n</span> <span class="Constant">o]</span> <span class="Comment"># editor screen triggers wrap of last line</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">4/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">4/right</span> <span class="Comment"># some part of last line is not displayed</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -3091,7 +3151,7 @@ e] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows entire wrapped line</span> screen-should-contain [ @@ -3107,7 +3167,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen resets</span> screen-should-contain [ @@ -3121,13 +3181,14 @@ e] ] <span class="muScenario">scenario</span> editor-can-scroll-up-wrapped-lines-2 [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines for text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># editor contains a very long line that occupies last two lines of screen</span> <span class="Comment"># and still has something left over</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">bcdefgh]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">4/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">4/right</span> <span class="Comment"># some part of last line is not displayed</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -3140,7 +3201,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen shows entire wrapped line</span> screen-should-contain [ @@ -3154,7 +3215,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen resets</span> screen-should-contain [ @@ -3166,9 +3227,10 @@ e] ] <span class="muScenario">scenario</span> editor-can-scroll-up-past-nonempty-lines [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># text with empty line in second screen</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[axx</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[axx</span> <span class="Constant">bxx</span> <span class="Constant">cxx</span> <span class="Constant">dxx</span> @@ -3177,7 +3239,7 @@ e] <span class="Constant">gxx</span> <span class="Constant">hxx</span> <span class="Constant">]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">4/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">4/right</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .axx .</span> @@ -3188,7 +3250,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -3200,7 +3262,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -3213,7 +3275,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -3224,9 +3286,10 @@ e] ] <span class="muScenario">scenario</span> editor-can-scroll-up-past-empty-lines [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">4/height</span> <span class="Comment"># text with empty line in second screen</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[axy</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[axy</span> <span class="Constant">bxy</span> <span class="Constant">cxy</span> @@ -3235,7 +3298,7 @@ exy fxy gxy ] - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">4/right</span> + e:&:editor<span class="Special"> <- </span>new-editor s, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">4/right</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .axy .</span> @@ -3246,7 +3309,7 @@ gxy press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -3258,7 +3321,7 @@ gxy press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -3271,7 +3334,7 @@ gxy press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> diff --git a/html/edit/004-programming-environment.mu.html b/html/edit/004-programming-environment.mu.html index 39b29125..5b97c018 100644 --- a/html/edit/004-programming-environment.mu.html +++ b/html/edit/004-programming-environment.mu.html @@ -14,14 +14,13 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background- body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.muData { color: #ffff00; } .Special { color: #c00000; } .muScenario { color: #00af00; } .Delimiter { color: #800080; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } -.CommentedCode { color: #6c6c6c; } +.muData { color: #ffff00; } .muControl { color: #c0a020; } --> </style> @@ -119,7 +118,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-unless</span> is-touch? <span class="Comment"># ignore all but 'left-click' events for now</span> <span class="Comment"># todo: test this</span> - touch-type:num<span class="Special"> <- </span>get t, <span class="Constant">type:offset</span> + touch-type:num<span class="Special"> <- </span>get t, <span class="muData">type</span>:offset is-left-click?:bool<span class="Special"> <- </span>equal touch-type, <span class="Constant">65513/mouse-left</span> <span class="muControl">loop-unless</span> is-left-click?, <span class="Constant">+next-event:label</span> click-row:num<span class="Special"> <- </span>get t, <span class="Constant">row:offset</span> @@ -329,12 +328,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> point-at-multiple-editors [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">30/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize both halves of screen</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[def]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[abc]</span>, <span class="Constant">[def]</span> <span class="Comment"># focus on both sides</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">1</span> @@ -342,11 +340,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># check cursor column in each</span> run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:&:editor<span class="Special"> <- </span>get *<span class="Constant">3</span>:&:environment, <span class="Constant">recipes:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">4</span>:&:editor, <span class="Constant">cursor-column:offset</span> - <span class="Constant">6</span>:&:editor<span class="Special"> <- </span>get *<span class="Constant">3</span>:&:environment, <span class="Constant">current-sandbox:offset</span> - <span class="Constant">7</span>:num<span class="Special"> <- </span>get *<span class="Constant">6</span>:&:editor, <span class="Constant">cursor-column:offset</span> + event-loop screen:&:screen, console:&:console, env + recipes:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> + <span class="Constant">5</span>:num/<span class="Special">raw <- </span>get *recipes, <span class="Constant">cursor-column:offset</span> + sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + <span class="Constant">7</span>:num/<span class="Special">raw <- </span>get *sandbox, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -355,26 +353,25 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> edit-multiple-editors [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">30/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize both halves of screen</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[def]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[abc]</span>, <span class="Constant">[def]</span> + render-all screen, env, render <span class="Comment"># type one letter in each of them</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">1</span> - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> left-click <span class="Constant">1</span>, <span class="Constant">17</span> - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:&:editor<span class="Special"> <- </span>get *<span class="Constant">3</span>:&:environment, <span class="Constant">recipes:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">4</span>:&:editor, <span class="Constant">cursor-column:offset</span> - <span class="Constant">6</span>:&:editor<span class="Special"> <- </span>get *<span class="Constant">3</span>:&:environment, <span class="Constant">current-sandbox:offset</span> - <span class="Constant">7</span>:num<span class="Special"> <- </span>get *<span class="Constant">6</span>:&:editor, <span class="Constant">cursor-column:offset</span> + event-loop screen:&:screen, console:&:console, env + recipes:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> + <span class="Constant">5</span>:num/<span class="Special">raw <- </span>get *recipes, <span class="Constant">cursor-column:offset</span> + sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + <span class="Constant">7</span>:num/<span class="Special">raw <- </span>get *sandbox, <span class="Constant">cursor-column:offset</span> ] screen-should-contain [ <span class="Constant"> . run (F4) . # this line has a different background, but we don't test that yet</span> @@ -388,8 +385,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># show the cursor at the right window</span> run [ - <span class="Constant">8</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">8</span>:char/cursor + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -400,13 +397,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> multiple-editors-cover-only-their-own-areas [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">60/width</span>, <span class="Constant">10/height</span> run [ - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[def]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[abc]</span>, <span class="Constant">[def]</span> + render-all screen, env, render ] <span class="Comment"># divider isn't messed up</span> screen-should-contain [ @@ -419,18 +415,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-in-focus-keeps-cursor [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">30/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[def]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[abc]</span>, <span class="Constant">[def]</span> + render-all screen, env, render <span class="Comment"># initialize programming environment and highlight cursor</span> assume-console <span class="Constant">[]</span> run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># is cursor at the right place?</span> screen-should-contain [ @@ -441,12 +436,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># now try typing a letter</span> assume-console [ - type <span class="Constant">[z]</span> + <span class="muData">type</span> <span class="Constant">[z]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># cursor should still be right</span> screen-should-contain [ @@ -458,14 +453,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> backspace-in-sandbox-editor-joins-lines [ -<span class="CommentedCode">#? trace-until 100/app # trace too long</span> + <span class="Constant">local-scope</span> + trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">30/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize sandbox side with two lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, s:text + render-all screen, env, render screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊abc .</span> @@ -479,9 +474,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press backspace ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># cursor moves to end of old line</span> screen-should-contain [ diff --git a/html/edit/005-sandbox.mu.html b/html/edit/005-sandbox.mu.html index 6aea4d1f..5afc8a83 100644 --- a/html/edit/005-sandbox.mu.html +++ b/html/edit/005-sandbox.mu.html @@ -14,13 +14,13 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background- body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.muData { color: #ffff00; } .Special { color: #c00000; } .muScenario { color: #00af00; } .Delimiter { color: #800080; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } +.muData { color: #ffff00; } .muControl { color: #c0a020; } --> </style> @@ -77,19 +77,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-and-show-results [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> <span class="Comment"># recipe editor is empty</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Comment"># sandbox editor contains an instruction without storing outputs</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[divide-with-remainder 11, 3]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[divide-with-remainder 11, 3]</span> <span class="Comment"># run the code in the editors</span> assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># check that screen prints the results</span> screen-should-contain [ @@ -135,13 +134,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># run another command</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">80</span> - type <span class="Constant">[add 2, 2]</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] - <span class="Comment"># check that screen prints the results</span> + <span class="Comment"># check that screen prints both sandboxes</span> screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -551,23 +550,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-updates-results [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">12/height</span> <span class="Comment"># define a recipe (no indent for the 'add' line below so column numbers are more obvious)</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant">local-scope</span> <span class="Constant">z:num <- add 2, 2</span> <span class="Constant">reply z</span> <span class="Constant">]</span>] <span class="Comment"># sandbox editor contains an instruction without storing outputs</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> <span class="Comment"># run the code in the editors</span> assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -583,11 +582,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ left-click <span class="Constant">4</span>, <span class="Constant">28</span> <span class="Comment"># one past the value of the second arg</span> press backspace - type <span class="Constant">[3]</span> + <span class="muData">type</span> <span class="Constant">[3]</span> press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># check that screen updates the result on the right</span> screen-should-contain [ @@ -604,19 +603,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-instruction-manages-screen-per-sandbox [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">20/height</span> <span class="Comment"># left editor is empty</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Comment"># right editor contains an instruction</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[print-integer screen, 4]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[print-integer screen, 4]</span> <span class="Comment"># run the code in the editor</span> assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># check that it prints a little toy screen</span> screen-should-contain [ @@ -656,20 +654,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-provides-edited-contents [ + <span class="Constant">local-scope</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">2</span> - type <span class="Constant">[def]</span> + <span class="muData">type</span> <span class="Constant">[def]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:text<span class="Special"> <- </span>editor-contents <span class="Constant">2</span>:&:editor - <span class="Constant">4</span>:@:char<span class="Special"> <- </span>copy *<span class="Constant">3</span>:text + editor-event-loop screen:&:screen, console:&:console, e + s:text<span class="Special"> <- </span>editor-contents e + <span class="Constant">1</span>:@:char/<span class="Special">raw <- </span>copy *s ] memory-should-contain [ - <span class="Constant">4</span>:array:character<span class="Special"> <- </span><span class="Constant">[abdefc]</span> + <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[abdefc]</span> ] ] @@ -830,18 +828,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># scrolling through sandboxes</span> <span class="muScenario">scenario</span> scrolling-down-past-bottom-of-sandbox-editor [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize sandbox side</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[add 2, 2]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[add 2, 2]</span> + render-all screen, env, render assume-console [ <span class="Comment"># create a sandbox</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -855,9 +852,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> @@ -873,9 +870,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-up ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># sandbox editor displays again, cursor is in editor</span> screen-should-contain [ @@ -963,27 +960,27 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> scrolling-down-on-recipe-side [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize sandbox side and create a sandbox</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">]</span> <span class="Comment"># create a sandbox</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[add 2, 2]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes:text, <span class="Constant">[add 2, 2]</span> + render-all screen, env, render assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env <span class="Comment"># hit 'down' in recipe editor</span> assume-console [ press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># cursor moves down on recipe side</span> screen-should-contain [ @@ -996,24 +993,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> scrolling-through-multiple-sandboxes [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + render-all screen, env, render <span class="Comment"># create 2 sandboxes</span> assume-console [ press ctrl-n - type <span class="Constant">[add 2, 2]</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> press F4 - type <span class="Constant">[add 1, 1]</span> + <span class="muData">type</span> <span class="Constant">[add 1, 1]</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊␣ .</span> @@ -1031,9 +1027,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> @@ -1053,7 +1049,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># just second sandbox displayed</span> screen-should-contain [ @@ -1070,7 +1066,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># no change</span> screen-should-contain [ @@ -1087,7 +1083,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-up ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># back to displaying both sandboxes without editor</span> screen-should-contain [ @@ -1106,9 +1102,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-up ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># back to displaying both sandboxes as well as editor</span> screen-should-contain [ @@ -1128,9 +1124,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-up ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># no change</span> screen-should-contain [ @@ -1148,20 +1144,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> scrolling-manages-sandbox-index-correctly [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + render-all screen, env, render <span class="Comment"># create a sandbox</span> assume-console [ press ctrl-n - type <span class="Constant">[add 1, 1]</span> + <span class="muData">type</span> <span class="Constant">[add 1, 1]</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -1177,7 +1172,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> @@ -1195,7 +1190,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-up ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># back to displaying both sandboxes as well as editor</span> screen-should-contain [ @@ -1213,7 +1208,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> diff --git a/html/edit/006-sandbox-copy.mu.html b/html/edit/006-sandbox-copy.mu.html index dd5adf80..4ed88981 100644 --- a/html/edit/006-sandbox-copy.mu.html +++ b/html/edit/006-sandbox-copy.mu.html @@ -20,6 +20,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } +.muData { color: #ffff00; } .muControl { color: #c0a020; } --> </style> @@ -36,20 +37,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="SalientComment">## see code operate in multiple situations</span> <span class="muScenario">scenario</span> copy-a-sandbox-to-editor [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># basic recipe</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> reply 4</span> <span class="Constant">]</span>] + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> <span class="Comment"># run it</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> assume-console [ press F4 ] - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -65,7 +66,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">3</span>, <span class="Constant">69</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># it copies into editor</span> screen-should-contain [ @@ -80,10 +81,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -98,20 +99,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> copy-a-sandbox-to-editor-2 [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># basic recipe</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> reply 4</span> <span class="Constant">]</span>] + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> <span class="Comment"># run it</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> assume-console [ press F4 ] - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -127,7 +128,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">3</span>, <span class="Constant">84</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># it copies into editor</span> screen-should-contain [ @@ -142,10 +143,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -255,20 +256,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> copy-fails-if-sandbox-editor-not-empty [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># basic recipe</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> reply 4</span> <span class="Constant">]</span>] + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> <span class="Comment"># run it</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> assume-console [ press F4 ] - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -282,11 +283,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># type something into the sandbox editor, then click on the 'copy' button</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">70</span> <span class="Comment"># put cursor in sandbox editor</span> - type <span class="Constant">[0]</span> <span class="Comment"># type something</span> + <span class="muData">type</span> <span class="Constant">[0]</span> <span class="Comment"># type something</span> left-click <span class="Constant">3</span>, <span class="Constant">70</span> <span class="Comment"># click 'copy' button</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># copy doesn't happen</span> screen-should-contain [ @@ -301,10 +302,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> diff --git a/html/edit/007-sandbox-delete.mu.html b/html/edit/007-sandbox-delete.mu.html index 21cb2be6..931df954 100644 --- a/html/edit/007-sandbox-delete.mu.html +++ b/html/edit/007-sandbox-delete.mu.html @@ -20,6 +20,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } +.muData { color: #ffff00; } .muControl { color: #c0a020; } --> </style> @@ -35,20 +36,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="SalientComment">## deleting sandboxes</span> <span class="muScenario">scenario</span> deleting-sandboxes [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> <span class="Comment"># run a few commands</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">80</span> - type <span class="Constant">[divide-with-remainder 11, 3]</span> + <span class="muData">type</span> <span class="Constant">[divide-with-remainder 11, 3]</span> press F4 - type <span class="Constant">[add 2, 2]</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -69,7 +69,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">7</span>, <span class="Constant">85</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -87,7 +87,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">3</span>, <span class="Constant">99</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -182,23 +182,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> deleting-sandbox-after-scroll [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + render-all screen, env, render <span class="Comment"># create 2 sandboxes and scroll to second</span> assume-console [ press ctrl-n - type <span class="Constant">[add 2, 2]</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> press F4 - type <span class="Constant">[add 1, 1]</span> + <span class="muData">type</span> <span class="Constant">[add 1, 1]</span> press F4 press page-down ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> @@ -213,7 +212,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">6</span>, <span class="Constant">99</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># second sandbox shows in editor; scroll resets to display first sandbox</span> screen-should-contain [ @@ -228,23 +227,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> deleting-top-sandbox-after-scroll [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + render-all screen, env, render <span class="Comment"># create 2 sandboxes and scroll to second</span> assume-console [ press ctrl-n - type <span class="Constant">[add 2, 2]</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> press F4 - type <span class="Constant">[add 1, 1]</span> + <span class="muData">type</span> <span class="Constant">[add 1, 1]</span> press F4 press page-down ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> @@ -259,7 +257,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">2</span>, <span class="Constant">99</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># second sandbox shows in editor; scroll resets to display first sandbox</span> screen-should-contain [ @@ -274,24 +272,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> deleting-final-sandbox-after-scroll [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + render-all screen, env, render <span class="Comment"># create 2 sandboxes and scroll to second</span> assume-console [ press ctrl-n - type <span class="Constant">[add 2, 2]</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> press F4 - type <span class="Constant">[add 1, 1]</span> + <span class="muData">type</span> <span class="Constant">[add 1, 1]</span> press F4 press page-down press page-down ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> @@ -306,7 +303,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">2</span>, <span class="Constant">99</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># implicitly scroll up to first sandbox</span> screen-should-contain [ @@ -322,22 +319,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> deleting-updates-sandbox-count [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + render-all screen, env, render <span class="Comment"># create 2 sandboxes</span> assume-console [ press ctrl-n - type <span class="Constant">[add 2, 2]</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> press F4 - type <span class="Constant">[add 1, 1]</span> + <span class="muData">type</span> <span class="Constant">[add 1, 1]</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -357,7 +353,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># shouldn't go past last sandbox</span> screen-should-contain [ diff --git a/html/edit/008-sandbox-edit.mu.html b/html/edit/008-sandbox-edit.mu.html index b7fbe660..9be5a9a1 100644 --- a/html/edit/008-sandbox-edit.mu.html +++ b/html/edit/008-sandbox-edit.mu.html @@ -20,6 +20,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } +.muData { color: #ffff00; } .muControl { color: #c0a020; } --> </style> @@ -35,20 +36,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="SalientComment">## editing sandboxes after they've been created</span> <span class="muScenario">scenario</span> clicking-on-a-sandbox-moves-it-to-editor [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># basic recipe</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> reply 4</span> <span class="Constant">]</span>] + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> <span class="Comment"># run it</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> assume-console [ press F4 ] - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -64,7 +65,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">3</span>, <span class="Constant">55</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># it pops back into editor</span> screen-should-contain [ @@ -78,10 +79,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -95,20 +96,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> clicking-on-a-sandbox-moves-it-to-editor-2 [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># basic recipe</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> reply 4</span> <span class="Constant">]</span>] + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> <span class="Comment"># run it</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> assume-console [ press F4 ] - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -124,7 +125,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">3</span>, <span class="Constant">68</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># it pops back into editor</span> screen-should-contain [ @@ -138,10 +139,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -208,18 +209,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> sandbox-with-print-can-be-edited [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">20/height</span> <span class="Comment"># left editor is empty</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Comment"># right editor contains an instruction</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[print-integer screen, 4]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[print-integer screen, 4]</span> <span class="Comment"># run the sandbox</span> assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -240,7 +240,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">3</span>, <span class="Constant">65</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -252,24 +252,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editing-sandbox-after-scrolling-resets-scroll [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + render-all screen, env, render <span class="Comment"># create 2 sandboxes and scroll to second</span> assume-console [ press ctrl-n - type <span class="Constant">[add 2, 2]</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> press F4 - type <span class="Constant">[add 1, 1]</span> + <span class="muData">type</span> <span class="Constant">[add 1, 1]</span> press F4 press page-down press page-down ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> @@ -284,7 +283,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">2</span>, <span class="Constant">55</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># second sandbox shows in editor; scroll resets to display first sandbox</span> screen-should-contain [ @@ -300,22 +299,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editing-sandbox-updates-sandbox-count [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + render-all screen, env, render <span class="Comment"># create 2 sandboxes</span> assume-console [ press ctrl-n - type <span class="Constant">[add 2, 2]</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> press F4 - type <span class="Constant">[add 1, 1]</span> + <span class="muData">type</span> <span class="Constant">[add 1, 1]</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -334,7 +332,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># no change in contents</span> screen-should-contain [ @@ -356,7 +354,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># screen should show just final sandbox with the right index (1)</span> screen-should-contain [ diff --git a/html/edit/009-sandbox-test.mu.html b/html/edit/009-sandbox-test.mu.html index 579c4cf2..b9095f7e 100644 --- a/html/edit/009-sandbox-test.mu.html +++ b/html/edit/009-sandbox-test.mu.html @@ -14,13 +14,13 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background- body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 12pt; font-size: 1em; } .muScenario { color: #00af00; } -.muData { color: #ffff00; } .Special { color: #c00000; } .Delimiter { color: #800080; } .muRecipe { color: #ff8700; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } +.muData { color: #ffff00; } .muControl { color: #c0a020; } --> </style> @@ -36,20 +36,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="SalientComment">## clicking on sandbox results to 'fix' them and turn sandboxes into tests</span> <span class="muScenario">scenario</span> sandbox-click-on-result-toggles-color-to-green [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># basic recipe</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> reply 4</span> <span class="Constant">]</span>] + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes:text, <span class="Constant">[foo]</span> <span class="Comment"># run it</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> assume-console [ press F4 ] - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -65,7 +65,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">5</span>, <span class="Constant">51</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># color toggles to green</span> screen-should-contain-in-color <span class="Constant">2/green</span>, [ @@ -80,8 +80,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should remain unmoved</span> run [ - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -100,11 +100,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">11</span> <span class="Comment"># cursor to end of line</span> press backspace - type <span class="Constant">[3]</span> + <span class="muData">type</span> <span class="Constant">[3]</span> press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># result turns red</span> screen-should-contain-in-color <span class="Constant">1/red</span>, [ diff --git a/html/edit/010-sandbox-trace.mu.html b/html/edit/010-sandbox-trace.mu.html index 5ab47bb0..0bff823b 100644 --- a/html/edit/010-sandbox-trace.mu.html +++ b/html/edit/010-sandbox-trace.mu.html @@ -14,13 +14,13 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background- body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 12pt; font-size: 1em; } .muScenario { color: #00af00; } -.muData { color: #ffff00; } .Special { color: #c00000; } .Delimiter { color: #800080; } .muRecipe { color: #ff8700; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } +.muData { color: #ffff00; } .muControl { color: #c0a020; } --> </style> @@ -36,20 +36,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="SalientComment">## clicking on the code typed into a sandbox toggles its trace</span> <span class="muScenario">scenario</span> sandbox-click-on-code-toggles-app-trace [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># basic recipe</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> stash [abc]</span> ]] + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> <span class="Comment"># run it</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> assume-console [ press F4 ] - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -64,9 +64,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">4</span>, <span class="Constant">51</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor-icon<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor-icon + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># trace now printed and cursor shouldn't have budged</span> screen-should-contain [ @@ -90,8 +90,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">4</span>, <span class="Constant">55</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - print screen:&:screen, <span class="Constant">4</span>:char/cursor-icon + event-loop screen:&:screen, console:&:console, env + print screen:&:screen, cursor ] <span class="Comment"># trace hidden again</span> screen-should-contain [ @@ -106,21 +106,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> sandbox-shows-app-trace-and-result [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># basic recipe</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> stash [abc]</span> <span class="muControl">reply</span> <span class="Constant">4</span> ]] + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> <span class="Comment"># run it</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> assume-console [ press F4 ] - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -136,7 +136,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">4</span>, <span class="Constant">51</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># trace now printed above result</span> screen-should-contain [ @@ -154,17 +154,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> clicking-on-app-trace-does-nothing [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[stash 123456789]</span> <span class="Comment"># create and expand the trace</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[stash 123456789]</span> assume-console [ press F4 left-click <span class="Constant">4</span>, <span class="Constant">51</span> ] - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -178,7 +177,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">5</span>, <span class="Constant">57</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># no change; doesn't die</span> screen-should-contain [ diff --git a/html/edit/011-errors.mu.html b/html/edit/011-errors.mu.html index 990dd470..d9228d0e 100644 --- a/html/edit/011-errors.mu.html +++ b/html/edit/011-errors.mu.html @@ -15,9 +15,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color * { font-size: 12pt; font-size: 1em; } .muRecipe { color: #ff8700; } .muData { color: #ffff00; } -.Special { color: #c00000; } .muScenario { color: #00af00; } .Delimiter { color: #800080; } +.Special { color: #c00000; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } @@ -150,19 +150,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-shows-errors-in-get [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> get 123:num, foo:offset</span> <span class="Constant">]</span>] - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> @@ -190,22 +190,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-updates-status-with-first-erroneous-sandbox [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">80</span> <span class="Comment"># create invalid sandbox 1</span> - type <span class="Constant">[get foo, x:offset]</span> + <span class="muData">type</span> <span class="Constant">[get foo, x:offset]</span> press F4 <span class="Comment"># create invalid sandbox 0</span> - type <span class="Constant">[get foo, x:offset]</span> + <span class="muData">type</span> <span class="Constant">[get foo, x:offset]</span> press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># status line shows that error is in first sandbox</span> screen-should-contain [ @@ -214,25 +213,24 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-updates-status-with-first-erroneous-sandbox-2 [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">80</span> <span class="Comment"># create invalid sandbox 2</span> - type <span class="Constant">[get foo, x:offset]</span> + <span class="muData">type</span> <span class="Constant">[get foo, x:offset]</span> press F4 <span class="Comment"># create invalid sandbox 1</span> - type <span class="Constant">[get foo, x:offset]</span> + <span class="muData">type</span> <span class="Constant">[get foo, x:offset]</span> press F4 <span class="Comment"># create valid sandbox 0</span> - type <span class="Constant">[add 2, 2]</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># status line shows that error is in second sandbox</span> screen-should-contain [ @@ -241,25 +239,24 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-hides-errors-from-past-sandboxes [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[get foo, x:offset]</span> <span class="Comment"># invalid</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[get foo, x:offset]</span> <span class="Comment"># invalid</span> assume-console [ press F4 <span class="Comment"># generate error</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">58</span> press ctrl-k - type <span class="Constant">[add 2, 2]</span> <span class="Comment"># valid code</span> + <span class="muData">type</span> <span class="Constant">[add 2, 2]</span> <span class="Comment"># valid code</span> press F4 <span class="Comment"># update sandbox</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># error should disappear</span> screen-should-contain [ @@ -275,21 +272,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-updates-errors-for-shape-shifting-recipes [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> <span class="Comment"># define a shape-shifting recipe with an error</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[recipe foo x:_elem -> z:_elem [</span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[recipe foo x:_elem -> z:_elem [</span> <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Constant">y:&:num <- copy 0</span> <span class="Constant">z <- add x, y</span> <span class="Constant">]</span>] - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo 2]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo 2]</span> assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . errors found (0) run (F4) .</span> <span class="Constant"> .recipe foo x:_elem -> z:_elem [ ┊ .</span> @@ -306,7 +303,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># error should remain unchanged</span> screen-should-contain [ @@ -323,20 +320,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-avoids-spurious-errors-on-reloading-shape-shifting-recipes [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> <span class="Comment"># overload a well-known shape-shifting recipe</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[recipe length l:&:list:_elem -> n:num [</span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[recipe length l:&:list:_elem -> n:num [</span> <span class="Constant">]</span>] <span class="Comment"># call code that uses other variants of it, but not it itself</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[x:&:list:num <- copy 0</span> + sandbox:text<span class="Special"> <- </span>new <span class="Constant">[x:&:list:num <- copy 0</span> <span class="Constant">to-text x]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, sandbox <span class="Comment"># run it once</span> assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env <span class="Comment"># no errors anywhere on screen (can't check anything else, since to-text will return an address)</span> screen-should-contain-in-color <span class="Constant">1/red</span>, [ <span class="Constant"> . .</span> @@ -360,7 +358,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># still no errors</span> screen-should-contain-in-color <span class="Constant">1/red</span>, [ @@ -383,19 +381,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-shows-missing-type-errors [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> x <- copy 0</span> <span class="Constant">]</span>] - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> @@ -408,20 +406,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-shows-unbalanced-bracket-errors [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> <span class="Comment"># recipe is incomplete (unbalanced '[')</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo \\[</span> <span class="Constant"> x <- copy 0</span> <span class="Constant">]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> @@ -436,21 +434,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-shows-get-on-non-container-errors [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> local-scope</span> <span class="Constant"> x:&:point <- new point:type</span> <span class="Constant"> get x:&:point, 1:offset</span> <span class="Constant">]</span>] - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> @@ -468,22 +466,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-shows-non-literal-get-argument-errors [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> local-scope</span> <span class="Constant"> x:num <- copy 0</span> <span class="Constant"> y:&:point <- new point:type</span> <span class="Constant"> get *y:&:point, x:num</span> <span class="Constant">]</span>] - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> @@ -502,20 +500,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-shows-errors-everytime [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> <span class="Comment"># try to run a file with an error</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ </span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> local-scope</span> <span class="Constant"> x:num <- copy y:num</span> <span class="Constant">]</span>] - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> <span class="Constant"> . ┊foo .</span> @@ -532,7 +530,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> @@ -548,19 +546,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-instruction-and-print-errors [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> - <span class="Comment"># left editor is empty</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Comment"># right editor contains an illegal instruction</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[get 1234:num, foo:offset]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + sandbox:text<span class="Special"> <- </span>new <span class="Constant">[get 1234:num, foo:offset]</span> + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, sandbox <span class="Comment"># run the code in the editors</span> assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># check that screen prints error message in red</span> screen-should-contain [ @@ -611,20 +608,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> run-instruction-and-print-errors-only-once [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> - <span class="Comment"># left editor is empty</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Comment"># right editor contains an illegal instruction</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[get 1234:num, foo:offset]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + sandbox:text<span class="Special"> <- </span>new <span class="Constant">[get 1234:num, foo:offset]</span> + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, sandbox <span class="Comment"># run the code in the editors multiple times</span> assume-console [ press F4 press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># check that screen prints error message just once</span> screen-should-contain [ @@ -642,23 +638,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> sandbox-can-handle-infinite-loop [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">20/height</span> <span class="Comment"># left editor is empty</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[recipe foo [</span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[recipe foo [</span> <span class="Constant"> {</span> <span class="Constant"> loop</span> <span class="Constant"> }</span> <span class="Constant">]</span>] <span class="Comment"># right editor contains an instruction</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo]</span> <span class="Comment"># run the sandbox</span> assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] screen-should-contain [ <span class="Constant"> . errors found (0) run (F4) .</span> @@ -673,10 +669,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> sandbox-with-errors-shows-trace [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># generate a stash and a error</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[recipe foo [</span> + recipes:text<span class="Special"> <- </span>new <span class="Constant">[recipe foo [</span> <span class="Constant">local-scope</span> <span class="Constant">a:num <- next-ingredient</span> <span class="Constant">b:num <- next-ingredient</span> @@ -684,13 +681,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color _, c:num<span class="Special"> <- </span>divide-with-remainder a, b <span class="muControl">reply</span> b ]] - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[foo 4, 0]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, recipes, <span class="Constant">[foo 4, 0]</span> <span class="Comment"># run</span> assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env <span class="Comment"># screen prints error message</span> screen-should-contain [ <span class="Constant"> . errors found (0) run (F4) .</span> @@ -708,7 +704,7 @@ _, c:num<span class="Special"> <- </span>divide-with-remainder a, b left-click <span class="Constant">4</span>, <span class="Constant">55</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment + event-loop screen:&:screen, console:&:console, env ] <span class="Comment"># screen should expand trace</span> screen-should-contain [ diff --git a/html/edit/012-editor-undo.mu.html b/html/edit/012-editor-undo.mu.html index 45abb7e9..be0db050 100644 --- a/html/edit/012-editor-undo.mu.html +++ b/html/edit/012-editor-undo.mu.html @@ -15,9 +15,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color * { font-size: 12pt; font-size: 1em; } .muRecipe { color: #ff8700; } .muData { color: #ffff00; } -.Special { color: #c00000; } .muScenario { color: #00af00; } .Delimiter { color: #800080; } +.Special { color: #c00000; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } @@ -134,21 +134,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># undo typing</span> <span class="muScenario">scenario</span> editor-can-undo-typing [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor and type a character</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># character should be gone</span> screen-should-contain [ @@ -159,10 +159,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -264,21 +264,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-typing-multiple [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor and type multiple characters</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[012]</span> + <span class="muData">type</span> <span class="Constant">[012]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># all characters must be gone</span> screen-should-contain [ @@ -290,16 +290,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-typing-multiple-2 [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[a]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># type some characters</span> assume-console [ - type <span class="Constant">[012]</span> + <span class="muData">type</span> <span class="Constant">[012]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .012a .</span> @@ -311,7 +311,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># back to original text</span> screen-should-contain [ @@ -322,10 +322,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[3]</span> + <span class="muData">type</span> <span class="Constant">[3]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -336,17 +336,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-typing-enter [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[ abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># new line</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">8</span> press enter ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> . abc .</span> @@ -355,8 +355,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . .</span> ] <span class="Comment"># line is indented</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -366,10 +366,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">5</span> @@ -383,10 +383,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be at end of line</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -399,16 +399,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># redo typing</span> <span class="muScenario">scenario</span> editor-redo-typing [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor, type something, undo</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[a]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[012]</span> + <span class="muData">type</span> <span class="Constant">[012]</span> press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -420,7 +420,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># all characters must be back</span> screen-should-contain [ @@ -431,10 +431,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[3]</span> + <span class="muData">type</span> <span class="Constant">[3]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -463,16 +463,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-redo-typing-empty [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor, type something, undo</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[012]</span> + <span class="muData">type</span> <span class="Constant">[012]</span> press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> . .</span> @@ -484,7 +484,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># all characters must be back</span> screen-should-contain [ @@ -495,10 +495,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[3]</span> + <span class="muData">type</span> <span class="Constant">[3]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -509,23 +509,24 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-work-clears-redo-stack [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text, do some work, undo</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># do some more work</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .0abc .</span> @@ -538,7 +539,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># nothing should happen</span> screen-should-contain [ @@ -551,22 +552,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-redo-typing-and-enter-and-tab [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># insert some text and tabs, hit enter, some more text and tabs</span> assume-console [ press tab - type <span class="Constant">[ab]</span> + <span class="muData">type</span> <span class="Constant">[ab]</span> press tab - type <span class="Constant">[cd]</span> + <span class="muData">type</span> <span class="Constant">[cd]</span> press enter press tab - type <span class="Constant">[efg]</span> + <span class="muData">type</span> <span class="Constant">[efg]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> . ab cd .</span> @@ -574,8 +575,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">7</span> @@ -585,11 +586,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># typing in second line deleted, but not indent</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -606,11 +607,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># indent and newline deleted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">8</span> @@ -626,11 +627,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># empty screen</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> @@ -646,11 +647,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># first line inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">8</span> @@ -666,11 +667,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># newline and indent inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -687,11 +688,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># indent and newline deleted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">7</span> @@ -708,38 +709,39 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># undo cursor movement and scroll</span> <span class="muScenario">scenario</span> editor-can-undo-touch [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">1</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># click undone</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -798,21 +800,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-scroll [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">4/height</span> <span class="Comment"># editor contains a wrapped line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">cdefgh]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> <span class="Comment"># position cursor at end of screen and try to move right</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">3</span> press right-arrow ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> <span class="Comment"># screen scrolls</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -829,11 +832,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moved back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">3</span> @@ -847,10 +850,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -861,39 +864,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-left-arrow [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">1</span> press left-arrow ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -905,21 +909,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-up-arrow [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">1</span> press up-arrow ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -929,21 +934,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -955,39 +960,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-down-arrow [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> press down-arrow ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -999,29 +1005,28 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-ctrl-f [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with multiple pages of text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># scroll the page</span> assume-console [ press ctrl-f ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen should again show page 1</span> screen-should-contain [ @@ -1034,29 +1039,28 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-page-down [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with multiple pages of text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># scroll the page</span> assume-console [ press page-down ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen should again show page 1</span> screen-should-contain [ @@ -1069,30 +1073,29 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-ctrl-b [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with multiple pages of text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># scroll the page down and up</span> assume-console [ press page-down press ctrl-b ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen should again show page 2</span> screen-should-contain [ @@ -1105,30 +1108,29 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-page-up [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with multiple pages of text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># scroll the page down and up</span> assume-console [ press page-down press page-up ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen should again show page 2</span> screen-should-contain [ @@ -1141,39 +1143,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-ctrl-a [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor, then to start of line</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> press ctrl-a ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1185,39 +1188,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-home [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor, then to start of line</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> press home ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1229,39 +1233,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-ctrl-e [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor, then to start of line</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> press ctrl-e ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1273,39 +1278,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-end [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor, then to start of line</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> press end ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1317,13 +1323,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-multiple-arrows-in-the-same-direction [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> @@ -1331,9 +1338,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press right-arrow press up-arrow ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">3</span> @@ -1343,11 +1350,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># up-arrow is undone</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">3</span> @@ -1357,11 +1364,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># both right-arrows are undone</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1371,38 +1378,39 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># redo cursor movement and scroll</span> <span class="muScenario">scenario</span> editor-redo-touch [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text, click on a character, undo</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">1</span> press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># redo</span> assume-console [ press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves to left-click</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1428,19 +1436,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-separates-undo-insert-from-undo-cursor-move [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor, type some text, move the cursor, type some more text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[abc]</span> + <span class="muData">type</span> <span class="Constant">[abc]</span> left-click <span class="Constant">1</span>, <span class="Constant">1</span> - type <span class="Constant">[d]</span> + <span class="muData">type</span> <span class="Constant">[d]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .adbc .</span> @@ -1456,9 +1464,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># last letter typed is deleted</span> screen-should-contain [ @@ -1476,9 +1484,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># no change to screen; cursor moves</span> screen-should-contain [ @@ -1496,9 +1504,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># screen empty</span> screen-should-contain [ @@ -1516,9 +1524,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># first insert</span> screen-should-contain [ @@ -1536,9 +1544,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor moves</span> screen-should-contain [ @@ -1557,9 +1565,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># second insert</span> screen-should-contain [ @@ -1577,26 +1585,26 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># undo backspace</span> <span class="muScenario">scenario</span> editor-can-undo-and-redo-backspace [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># insert some text and hit backspace</span> assume-console [ - type <span class="Constant">[abc]</span> + <span class="muData">type</span> <span class="Constant">[abc]</span> press backspace press backspace ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1606,10 +1614,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">3</span> @@ -1625,10 +1633,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1722,29 +1730,29 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># undo delete</span> <span class="muScenario">scenario</span> editor-can-undo-and-redo-delete [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># insert some text and hit delete and backspace a few times</span> assume-console [ - type <span class="Constant">[abcdef]</span> + <span class="muData">type</span> <span class="Constant">[abcdef]</span> left-click <span class="Constant">1</span>, <span class="Constant">2</span> press delete press backspace press delete press delete ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .af .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1754,10 +1762,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1773,10 +1781,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -1792,10 +1800,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -1811,11 +1819,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># first line inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -1831,11 +1839,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># first line inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1851,11 +1859,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># first line inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1911,18 +1919,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># undo ctrl-k</span> <span class="muScenario">scenario</span> editor-can-undo-and-redo-ctrl-k [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># insert some text and hit delete and backspace a few times</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">1</span> press ctrl-k ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -1930,8 +1939,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1941,7 +1950,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1950,8 +1959,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1961,7 +1970,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># first line inserted</span> screen-should-contain [ @@ -1971,18 +1980,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2013,18 +2022,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># undo ctrl-u</span> <span class="muScenario">scenario</span> editor-can-undo-and-redo-ctrl-u [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># insert some text and hit delete and backspace a few times</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">2</span> press ctrl-u ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .c .</span> @@ -2032,8 +2042,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> @@ -2043,7 +2053,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2052,8 +2062,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -2063,7 +2073,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># first line inserted</span> screen-should-contain [ @@ -2073,18 +2083,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2114,18 +2124,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-and-redo-ctrl-u-2 [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># insert some text and hit delete and backspace a few times</span> assume-console [ - type <span class="Constant">[abc]</span> + <span class="muData">type</span> <span class="Constant">[abc]</span> press ctrl-u press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .abc .</span> |