diff options
Diffstat (limited to 'html/edit')
-rw-r--r-- | html/edit/001-editor.mu.html | 22 | ||||
-rw-r--r-- | html/edit/002-typing.mu.html | 196 | ||||
-rw-r--r-- | html/edit/003-shortcuts.mu.html | 570 | ||||
-rw-r--r-- | html/edit/004-programming-environment.mu.html | 94 | ||||
-rw-r--r-- | html/edit/005-sandbox.mu.html | 146 | ||||
-rw-r--r-- | html/edit/006-sandbox-copy.mu.html | 48 | ||||
-rw-r--r-- | html/edit/007-sandbox-delete.mu.html | 58 | ||||
-rw-r--r-- | html/edit/008-sandbox-edit.mu.html | 52 | ||||
-rw-r--r-- | html/edit/009-sandbox-test.mu.html | 22 | ||||
-rw-r--r-- | html/edit/010-sandbox-trace.mu.html | 32 | ||||
-rw-r--r-- | html/edit/011-errors.mu.html | 82 | ||||
-rw-r--r-- | html/edit/012-editor-undo.mu.html | 510 |
12 files changed, 916 insertions, 916 deletions
diff --git a/html/edit/001-editor.mu.html b/html/edit/001-editor.mu.html index b61e405d..a5b87d06 100644 --- a/html/edit/001-editor.mu.html +++ b/html/edit/001-editor.mu.html @@ -62,7 +62,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] -<span class="muData">container</span> editor-data [ +<span class="muData">container</span> editor [ <span class="Comment"># editable text: doubly linked list of characters (head contains a special sentinel)</span> data:&:duplex-list:char top-of-screen:&:duplex-list:char @@ -83,12 +83,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># creates a new editor widget and renders its initial appearance to screen</span> <span class="Comment"># top/left/right constrain the screen area available to the new editor</span> <span class="Comment"># right is exclusive</span> -<span class="muRecipe">def</span> new-editor s:text, screen:&:screen, left:num, right:num<span class="muRecipe"> -> </span>result:&:editor-data, screen:&:screen [ +<span class="muRecipe">def</span> new-editor s:text, screen:&:screen, left:num, right:num<span class="muRecipe"> -> </span>result:&:editor, screen:&:screen [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># no clipping of bounds</span> right<span class="Special"> <- </span>subtract right, <span class="Constant">1</span> - result<span class="Special"> <- </span>new <span class="Constant">editor-data:type</span> + result<span class="Special"> <- </span>new <span class="Constant">editor:type</span> <span class="Comment"># initialize screen-related fields</span> *result<span class="Special"> <- </span>put *result, <span class="Constant">left:offset</span>, left *result<span class="Special"> <- </span>put *result, <span class="Constant">right:offset</span>, right @@ -106,7 +106,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> <editor-initialization></span> ] -<span class="muRecipe">def</span> insert-text editor:&:editor-data, text:text<span class="muRecipe"> -> </span>editor:&:editor-data [ +<span class="muRecipe">def</span> insert-text editor:&:editor, text:text<span class="muRecipe"> -> </span>editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># early exit if text is empty</span> @@ -132,8 +132,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-initializes-without-data [ assume-screen <span class="Constant">5/width</span>, <span class="Constant">3/height</span> run [ - <span class="Constant">1</span>:&:editor-data<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-data<span class="Special"> <- </span>copy *<span class="Constant">1</span>:&:editor-data + <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 ] memory-should-contain [ <span class="Comment"># 2 (data) <- just the § sentinel</span> @@ -156,7 +156,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># Assumes cursor should be at coordinates (cursor-row, cursor-column) and</span> <span class="Comment"># updates before-cursor to match. Might also move coordinates if they're</span> <span class="Comment"># outside text.</span> -<span class="muRecipe">def</span> render screen:&:screen, editor:&:editor-data<span class="muRecipe"> -> </span>last-row:num, last-column:num, screen:&:screen, editor:&:editor-data [ +<span class="muRecipe">def</span> render screen:&:screen, editor:&:editor<span class="muRecipe"> -> </span>last-row:num, last-column:num, screen:&:screen, editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="muControl">return-unless</span> editor, <span class="Constant">1/top</span>, <span class="Constant">0/left</span>, screen/same-as-ingredient:<span class="Constant">0</span>, editor/same-as-ingredient:<span class="Constant">1</span> @@ -181,7 +181,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-unless</span> curr off-screen?:bool<span class="Special"> <- </span>greater-or-equal row, screen-height <span class="muControl">break-if</span> off-screen? - <span class="Comment"># update editor-data.before-cursor</span> + <span class="Comment"># update editor.before-cursor</span> <span class="Comment"># Doing so at the start of each iteration ensures it stays one step behind</span> <span class="Comment"># the current character.</span> <span class="Delimiter">{</span> @@ -378,9 +378,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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-data<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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] screen-should-contain [ <span class="Constant"> . .</span> diff --git a/html/edit/002-typing.mu.html b/html/edit/002-typing.mu.html index 815f5fab..469acd95 100644 --- a/html/edit/002-typing.mu.html +++ b/html/edit/002-typing.mu.html @@ -41,12 +41,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> open-console - editor:&:editor-data<span class="Special"> <- </span>new-editor text, <span class="Constant">0/screen</span>, <span class="Constant">5/left</span>, <span class="Constant">45/right</span> + editor:&:editor<span class="Special"> <- </span>new-editor text, <span class="Constant">0/screen</span>, <span class="Constant">5/left</span>, <span class="Constant">45/right</span> editor-event-loop <span class="Constant">0/screen</span>, <span class="Constant">0/console</span>, editor close-console ] -<span class="muRecipe">def</span> editor-event-loop screen:&:screen, console:&:console, editor:&:editor-data<span class="muRecipe"> -> </span>screen:&:screen, console:&:console, editor:&:editor-data [ +<span class="muRecipe">def</span> editor-event-loop screen:&:screen, console:&:console, editor:&:editor<span class="muRecipe"> -> </span>screen:&:screen, console:&:console, editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Delimiter">{</span> @@ -80,7 +80,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># process click, return if it was on current editor</span> -<span class="muRecipe">def</span> move-cursor-in-editor screen:&:screen, editor:&:editor-data, t:touch-event<span class="muRecipe"> -> </span>in-focus?:bool, editor:&:editor-data [ +<span class="muRecipe">def</span> move-cursor-in-editor screen:&:screen, editor:&:editor, t:touch-event<span class="muRecipe"> -> </span>in-focus?:bool, editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="muControl">return-unless</span> editor, <span class="Constant">0/false</span> @@ -105,7 +105,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># Variant of 'render' that only moves the cursor (coordinates and</span> <span class="Comment"># before-cursor). If it's past the end of a line, it 'slides' it left. If it's</span> <span class="Comment"># past the last line it positions at end of last line.</span> -<span class="muRecipe">def</span> snap-cursor screen:&:screen, editor:&:editor-data, target-row:num, target-column:num<span class="muRecipe"> -> </span>editor:&:editor-data [ +<span class="muRecipe">def</span> snap-cursor screen:&:screen, editor:&:editor, target-row:num, target-column:num<span class="muRecipe"> -> </span>editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="muControl">return-unless</span> editor @@ -128,7 +128,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-unless</span> curr off-screen?:bool<span class="Special"> <- </span>greater-or-equal row, screen-height <span class="muControl">break-if</span> off-screen? - <span class="Comment"># update editor-data.before-cursor</span> + <span class="Comment"># update editor.before-cursor</span> <span class="Comment"># Doing so at the start of each iteration ensures it stays one step behind</span> <span class="Comment"># the current character.</span> <span class="Delimiter">{</span> @@ -196,7 +196,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># Process an event 'e' and try to minimally update the screen.</span> <span class="Comment"># Set 'go-render?' to true to indicate the caller must perform a non-minimal update.</span> -<span class="muRecipe">def</span> handle-keyboard-event screen:&:screen, editor:&:editor-data, e:event<span class="muRecipe"> -> </span>screen:&:screen, editor:&:editor-data, go-render?:bool [ +<span class="muRecipe">def</span> handle-keyboard-event screen:&:screen, editor:&:editor, e:event<span class="muRecipe"> -> </span>screen:&:screen, editor:&:editor, go-render?:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> go-render?<span class="Special"> <- </span>copy <span class="Constant">0/false</span> @@ -236,7 +236,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">return</span> ] -<span class="muRecipe">def</span> insert-at-cursor editor:&:editor-data, c:char, screen:&:screen<span class="muRecipe"> -> </span>editor:&:editor-data, screen:&:screen, go-render?:bool [ +<span class="muRecipe">def</span> insert-at-cursor editor:&:editor, c:char, screen:&:screen<span class="muRecipe"> -> </span>editor:&:editor, screen:&:screen, go-render?:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> before-cursor:&:duplex-list:char<span class="Special"> <- </span>get *editor, <span class="Constant">before-cursor:offset</span> @@ -302,7 +302,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># helper for tests</span> -<span class="muRecipe">def</span> editor-render screen:&:screen, editor:&:editor-data<span class="muRecipe"> -> </span>screen:&:screen, editor:&:editor-data [ +<span class="muRecipe">def</span> editor-render screen:&:screen, editor:&:editor<span class="muRecipe"> -> </span>screen:&:screen, editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> left:num<span class="Special"> <- </span>get *editor, <span class="Constant">left:offset</span> @@ -318,11 +318,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-handles-empty-event-queue [ 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-data<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-data + <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 assume-console <span class="Constant">[]</span> run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -335,16 +335,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-handles-mouse-clicks [ 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-data<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-data + <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 <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -362,15 +362,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-handles-mouse-clicks-outside-text [ 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-data<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> + <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> <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor row</span> @@ -383,15 +383,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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">def]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor row</span> @@ -404,15 +404,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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">def]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Comment"># cursor row</span> @@ -425,17 +425,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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-data<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-data + <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 <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -453,17 +453,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-handles-mouse-clicks-in-menu-area [ 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-data<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-data + <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 <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># no change to cursor</span> memory-should-contain [ @@ -475,14 +475,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-inserts-characters-into-empty-editor [ 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-data<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-data + <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 <span class="Constant"> $clear-trace</span> assume-console [ type <span class="Constant">[abc]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -496,8 +496,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-inserts-characters-at-cursor [ 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-data<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-data + <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 <span class="Constant"> $clear-trace</span> <span class="Comment"># type two letters at different places</span> assume-console [ @@ -506,7 +506,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[d]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -520,15 +520,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-inserts-characters-at-cursor-2 [ 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-data<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-data + <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 <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> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -543,15 +543,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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">d]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -566,15 +566,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-inserts-characters-at-cursor-3 [ 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-data<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-data + <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 <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> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -589,15 +589,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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">d]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -613,15 +613,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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">d]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -636,13 +636,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-moves-cursor-after-inserting-characters [ 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-data<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-data + <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 assume-console [ type <span class="Constant">[01]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -657,14 +657,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-wraps-line-on-insert [ 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-data<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-data + <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 <span class="Comment"># type a letter</span> assume-console [ type <span class="Constant">[e]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># no wrap yet</span> screen-should-contain [ @@ -679,7 +679,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[f]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># now wrap</span> screen-should-contain [ @@ -696,17 +696,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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> <span class="Constant">defg]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor is not wrapped</span> memory-should-contain [ @@ -777,15 +777,15 @@ 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 [ 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-data<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">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> 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> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -806,7 +806,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># create an editor containing two lines</span> contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">xyz]</span> - <span class="Constant">1</span>:&:editor-data/<span class="Special">raw <- </span>new-editor contents, screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .abc .</span> @@ -818,7 +818,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <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-data/<span class="Special">raw</span> + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">1</span>:&:editor/<span class="Special">raw</span> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -832,15 +832,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-wraps-cursor-to-left-margin [ 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-data<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> + <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> 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> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -857,7 +857,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># if newline, move cursor to start of next line, and maybe align indent with previous line</span> -<span class="muData">container</span> editor-data [ +<span class="muData">container</span> editor [ indent?:bool ] @@ -868,13 +868,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-moves-cursor-down-after-inserting-newline [ 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-data<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> + <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> assume-console [ type <span class="Constant">[0</span> <span class="Constant">1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -897,7 +897,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> insert-new-line-and-indent editor:&:editor-data, screen:&:screen<span class="muRecipe"> -> </span>editor:&:editor-data, screen:&:screen, go-render?:bool [ +<span class="muRecipe">def</span> insert-new-line-and-indent editor:&:editor, screen:&:screen<span class="muRecipe"> -> </span>editor:&:editor, screen:&:screen, go-render?:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> cursor-row:num<span class="Special"> <- </span>get *editor, <span class="Constant">cursor-row:offset</span> @@ -974,13 +974,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-moves-cursor-down-after-inserting-newline-2 [ 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-data<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> + <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> assume-console [ type <span class="Constant">[0</span> <span class="Constant">1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -994,7 +994,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-clears-previous-line-completely-after-inserting-newline [ 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-data<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">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> assume-console [ press enter ] @@ -1006,7 +1006,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># line should be fully cleared</span> screen-should-contain [ @@ -1023,7 +1023,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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> + <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> <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> @@ -1031,9 +1031,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor should be below start of previous line</span> memory-should-contain [ @@ -1047,7 +1047,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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> + <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> <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 +1056,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor should be below start of previous line</span> memory-should-contain [ @@ -1110,7 +1110,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> screen<span class="Special"> <- </span>move-cursor screen, row, x <span class="Delimiter">{</span> - continue?:bool<span class="Special"> <- </span>lesser-or-equal x, right <span class="Comment"># right is inclusive, to match editor-data semantics</span> + continue?:bool<span class="Special"> <- </span>lesser-or-equal x, right <span class="Comment"># right is inclusive, to match editor semantics</span> <span class="muControl">break-unless</span> continue? print screen, style, color, bg-color x<span class="Special"> <- </span>add x, <span class="Constant">1</span> diff --git a/html/edit/003-shortcuts.mu.html b/html/edit/003-shortcuts.mu.html index 90879f62..8a6f0fbc 100644 --- a/html/edit/003-shortcuts.mu.html +++ b/html/edit/003-shortcuts.mu.html @@ -43,12 +43,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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> <span class="Constant">cd]</span> - <span class="Constant">2</span>:&:editor-data<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">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> assume-console [ press tab ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -75,17 +75,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-handles-backspace-key [ 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-data<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-data + <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 <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-data - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</span> + 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> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -114,7 +114,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># return values:</span> <span class="Comment"># go-render? - whether caller needs to update the screen</span> <span class="Comment"># backspaced-cell - value deleted (or 0 if nothing was deleted) so we can save it for undo, etc.</span> -<span class="muRecipe">def</span> delete-before-cursor editor:&:editor-data, screen:&:screen<span class="muRecipe"> -> </span>editor:&:editor-data, screen:&:screen, go-render?:bool, backspaced-cell:&:duplex-list:char [ +<span class="muRecipe">def</span> delete-before-cursor editor:&:editor, screen:&:screen<span class="muRecipe"> -> </span>editor:&:editor, screen:&:screen, go-render?:bool, backspaced-cell:&:duplex-list:char [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> before-cursor:&:duplex-list:char<span class="Special"> <- </span>get *editor, <span class="Constant">before-cursor:offset</span> @@ -165,7 +165,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color go-render?<span class="Special"> <- </span>copy <span class="Constant">0/false</span> ] -<span class="muRecipe">def</span> move-cursor-coordinates-left editor:&:editor-data<span class="muRecipe"> -> </span>editor:&:editor-data, go-render?:bool [ +<span class="muRecipe">def</span> move-cursor-coordinates-left editor:&:editor<span class="muRecipe"> -> </span>editor:&:editor, go-render?:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> before-cursor:&:duplex-list:char<span class="Special"> <- </span>get *editor, <span class="Constant">before-cursor:offset</span> @@ -254,15 +254,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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> <span class="Constant">cd]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> 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-data - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</span> + 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> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -281,8 +281,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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> <span class="Constant">ghi jkl]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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 +290,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># resulting single line should wrap correctly</span> screen-should-contain [ @@ -306,8 +306,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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-data<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-data + <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 <span class="Comment"># confirm that it wraps</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -322,7 +322,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># resulting single line should wrap correctly and not overflow its bounds</span> screen-should-contain [ @@ -339,14 +339,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-handles-delete-key [ 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-data<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-data + <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 <span class="Constant"> $clear-trace</span> assume-console [ press delete ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -360,7 +360,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -382,7 +382,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> delete-at-cursor editor:&:editor-data, screen:&:screen<span class="muRecipe"> -> </span>editor:&:editor-data, screen:&:screen, go-render?:bool, deleted-cell:&:duplex-list:char [ +<span class="muRecipe">def</span> delete-at-cursor editor:&:editor, screen:&:screen<span class="muRecipe"> -> </span>editor:&:editor, screen:&:screen, go-render?:bool, deleted-cell:&:duplex-list:char [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> before-cursor:&:duplex-list:char<span class="Special"> <- </span>get *editor, <span class="Constant">before-cursor:offset</span> @@ -428,15 +428,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-moves-cursor-right-with-key [ 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-data<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-data + <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 <span class="Constant"> $clear-trace</span> assume-console [ press right-arrow type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -466,7 +466,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> move-cursor-coordinates-right editor:&:editor-data, screen-height:num<span class="muRecipe"> -> </span>editor:&:editor-data, go-render?:bool [ +<span class="muRecipe">def</span> move-cursor-coordinates-right editor:&:editor, screen-height:num<span class="muRecipe"> -> </span>editor:&:editor, go-render?:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> before-cursor:&:duplex-list:char<span class="Special"> <- </span>get *editor <span class="Constant">before-cursor:offset</span> @@ -526,8 +526,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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">d]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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,7 +537,7 @@ 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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] 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> @@ -545,7 +545,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -561,8 +561,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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">d]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 assume-console [ press right-arrow press right-arrow @@ -571,7 +571,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -585,17 +585,17 @@ 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 [ 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-data<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-data + <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 <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -615,8 +615,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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-data<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-data + <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 <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 +624,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -637,9 +637,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -651,17 +651,17 @@ 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 [ 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-data<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-data + <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 <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] screen-should-contain [ <span class="Constant"> . .</span> @@ -681,8 +681,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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">d]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <span class="Constant"> $clear-trace</span> <span class="Comment"># move to end of line, press right-arrow, type a character</span> assume-console [ @@ -691,7 +691,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># new character should be in next line</span> screen-should-contain [ @@ -711,8 +711,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-moves-cursor-left-with-key [ 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-data<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-data + <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 <span class="Constant"> $clear-trace</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">2</span> @@ -720,7 +720,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -755,8 +755,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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 +764,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -781,8 +781,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 <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> @@ -792,7 +792,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -809,8 +809,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 <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 [ @@ -819,7 +819,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># left-arrow should have had no effect</span> screen-should-contain [ @@ -838,8 +838,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> d] - <span class="Constant">2</span>:&:editor-data<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-data + <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 <span class="Constant"> $clear-trace</span> <span class="Comment"># position cursor right after empty line</span> assume-console [ @@ -848,7 +848,7 @@ d] type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -864,8 +864,8 @@ d] 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-data<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-data + <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 <span class="Constant"> $clear-trace</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -880,9 +880,9 @@ d] press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># previous row</span> @@ -896,8 +896,8 @@ d] <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> <span class="Constant">g]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <span class="Constant"> $clear-trace</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -912,9 +912,9 @@ d] press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Comment"># previous row</span> @@ -928,8 +928,8 @@ d] <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> <span class="Constant">e]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <span class="Constant"> $clear-trace</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -944,9 +944,9 @@ d] press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># previous row</span> @@ -963,17 +963,17 @@ d] 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">def]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -984,7 +984,7 @@ d] type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1007,7 +1007,7 @@ d] <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> move-to-previous-line editor:&:editor-data<span class="muRecipe"> -> </span>editor:&:editor-data, go-render?:bool [ +<span class="muRecipe">def</span> move-to-previous-line editor:&:editor<span class="muRecipe"> -> </span>editor:&:editor, go-render?:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> cursor-row:num<span class="Special"> <- </span>get *editor, <span class="Constant">cursor-row:offset</span> @@ -1079,17 +1079,17 @@ d] 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">def]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1100,7 +1100,7 @@ d] type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1115,17 +1115,17 @@ d] 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="muRecipe">def</span>] - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1136,7 +1136,7 @@ d] type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1153,8 +1153,8 @@ d] <span class="Constant">1</span>: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-data<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-data + <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 <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 +1162,9 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -1175,7 +1175,7 @@ d] type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1192,17 +1192,17 @@ d] 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">def]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># ..and ends at (2, 0)</span> memory-should-contain [ @@ -1214,7 +1214,7 @@ d] type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1237,7 +1237,7 @@ d] <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> move-to-next-line editor:&:editor-data, screen-height:num<span class="muRecipe"> -> </span>editor:&:editor-data, go-render?:bool [ +<span class="muRecipe">def</span> move-to-next-line editor:&:editor, screen-height:num<span class="muRecipe"> -> </span>editor:&:editor, go-render?:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> cursor-row:num<span class="Special"> <- </span>get *editor, <span class="Constant">cursor-row:offset</span> @@ -1297,17 +1297,17 @@ d] 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">de]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -1318,7 +1318,7 @@ d] type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1335,8 +1335,8 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <span class="Constant"> $clear-trace</span> <span class="Comment"># start on second line, press ctrl-a</span> assume-console [ @@ -1344,9 +1344,9 @@ d] press ctrl-a ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</span> + 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> ] <span class="Comment"># cursor moves to start of line</span> memory-should-contain [ @@ -1382,7 +1382,7 @@ d] <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> move-to-start-of-line editor:&:editor-data<span class="muRecipe"> -> </span>editor:&:editor-data [ +<span class="muRecipe">def</span> move-to-start-of-line editor:&:editor<span class="muRecipe"> -> </span>editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># update cursor column</span> @@ -1410,8 +1410,8 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <span class="Constant"> $clear-trace</span> <span class="Comment"># start on first line (no newline before), press ctrl-a</span> assume-console [ @@ -1419,9 +1419,9 @@ d] press ctrl-a ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</span> + 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> ] <span class="Comment"># cursor moves to start of line</span> memory-should-contain [ @@ -1435,7 +1435,7 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <span class="Constant"> $clear-trace</span> <span class="Comment"># start on second line, press 'home'</span> assume-console [ @@ -1443,9 +1443,9 @@ d] press home ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves to start of line</span> memory-should-contain [ @@ -1459,8 +1459,8 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <span class="Constant"> $clear-trace</span> <span class="Comment"># start on first line (no newline before), press 'home'</span> assume-console [ @@ -1468,9 +1468,9 @@ d] press home ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves to start of line</span> memory-should-contain [ @@ -1486,8 +1486,8 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <span class="Constant"> $clear-trace</span> <span class="Comment"># start on first line, press ctrl-e</span> assume-console [ @@ -1495,9 +1495,9 @@ d] press ctrl-e ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</span> + 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> ] <span class="Comment"># cursor moves to end of line</span> memory-should-contain [ @@ -1510,9 +1510,9 @@ d] type <span class="Constant">[z]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</span> + 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> ] memory-should-contain [ <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1554,7 +1554,7 @@ d] <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> move-to-end-of-line editor:&:editor-data<span class="muRecipe"> -> </span>editor:&:editor-data [ +<span class="muRecipe">def</span> move-to-end-of-line editor:&:editor<span class="muRecipe"> -> </span>editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> before-cursor:&:duplex-list:char<span class="Special"> <- </span>get *editor, <span class="Constant">before-cursor:offset</span> @@ -1578,8 +1578,8 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <span class="Constant"> $clear-trace</span> <span class="Comment"># start on second line (no newline after), press ctrl-e</span> assume-console [ @@ -1587,9 +1587,9 @@ d] press ctrl-e ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</span> + 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> ] <span class="Comment"># cursor moves to end of line</span> memory-should-contain [ @@ -1603,8 +1603,8 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <span class="Constant"> $clear-trace</span> <span class="Comment"># start on first line, press 'end'</span> assume-console [ @@ -1612,9 +1612,9 @@ d] press end ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves to end of line</span> memory-should-contain [ @@ -1628,8 +1628,8 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <span class="Constant"> $clear-trace</span> <span class="Comment"># start on second line (no newline after), press 'end'</span> assume-console [ @@ -1637,9 +1637,9 @@ d] press end ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves to end of line</span> memory-should-contain [ @@ -1655,14 +1655,14 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># cursor deletes to start of line</span> screen-should-contain [ @@ -1686,7 +1686,7 @@ d] <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> delete-to-start-of-line editor:&:editor-data<span class="muRecipe"> -> </span>result:&:duplex-list:char, editor:&:editor-data [ +<span class="muRecipe">def</span> delete-to-start-of-line editor:&:editor<span class="muRecipe"> -> </span>result:&:duplex-list:char, editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># compute range to delete</span> @@ -1718,14 +1718,14 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># cursor deletes to start of line</span> screen-should-contain [ @@ -1741,14 +1741,14 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># cursor deletes to start of line</span> screen-should-contain [ @@ -1764,14 +1764,14 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># cursor deletes to start of line</span> screen-should-contain [ @@ -1789,14 +1789,14 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># cursor deletes to end of line</span> screen-should-contain [ @@ -1820,7 +1820,7 @@ d] <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> delete-to-end-of-line editor:&:editor-data<span class="muRecipe"> -> </span>result:&:duplex-list:char, editor:&:editor-data [ +<span class="muRecipe">def</span> delete-to-end-of-line editor:&:editor<span class="muRecipe"> -> </span>result:&:duplex-list:char, editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># compute range to delete</span> @@ -1844,14 +1844,14 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># cursor deletes to end of line</span> screen-should-contain [ @@ -1867,14 +1867,14 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># cursor deletes just last character</span> screen-should-contain [ @@ -1890,14 +1890,14 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># cursor deletes nothing</span> screen-should-contain [ @@ -1913,14 +1913,14 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># cursor deletes just the final character</span> screen-should-contain [ @@ -1936,14 +1936,14 @@ d] 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> <span class="Constant">456]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># cursor deletes nothing</span> screen-should-contain [ @@ -1965,7 +1965,7 @@ d] <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -1978,7 +1978,7 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen slides by one line</span> screen-should-contain [ @@ -2043,7 +2043,7 @@ d] <span class="Constant">g</span> <span class="Constant">h</span> <span class="Constant">i]</span> - <span class="Constant">2</span>:&:editor-data<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">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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .abcd↩ .</span> @@ -2056,7 +2056,7 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2075,14 +2075,14 @@ d] <span class="Constant">k</span> <span class="Constant">l</span> <span class="Constant">m]</span> - <span class="Constant">2</span>:&:editor-data<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">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="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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows partial wrapped line containing a wrap icon</span> screen-should-contain [ @@ -2096,7 +2096,7 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2114,16 +2114,16 @@ d] <span class="Constant">1</span>: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-data<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">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="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> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># screen scrolls</span> screen-should-contain [ @@ -2144,16 +2144,16 @@ d] <span class="Constant">1</span>: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-data<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">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> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">4</span> type [ ] ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># screen scrolls</span> screen-should-contain [ @@ -2175,16 +2175,16 @@ d] <span class="Constant">1</span>: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-data<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">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="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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># screen scrolls</span> screen-should-contain [ @@ -2207,16 +2207,16 @@ d] <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor-data<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">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="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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># screen scrolls</span> screen-should-contain [ @@ -2235,8 +2235,8 @@ d] 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">de]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <span class="Constant"> $clear-trace</span> <span class="Comment"># try to move down past end of text</span> assume-console [ @@ -2244,9 +2244,9 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># screen should scroll, moving cursor to end of text</span> memory-should-contain [ @@ -2257,7 +2257,7 @@ d] type <span class="Constant">[0]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2272,9 +2272,9 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># screen stops scrolling because cursor is already at top</span> memory-should-contain [ @@ -2286,7 +2286,7 @@ d] type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2307,7 +2307,7 @@ d] <span class="Constant">e</span> <span class="Constant">f</span> <span class="Constant">g]</span> - <span class="Constant">2</span>:&:editor-data<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">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="Comment"># scroll down one page and one line</span> assume-console [ press page-down @@ -2315,7 +2315,7 @@ d] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen scrolls down 3 lines</span> screen-should-contain [ @@ -2336,7 +2336,7 @@ d] <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -2349,7 +2349,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen slides by one line</span> screen-should-contain [ @@ -2374,7 +2374,7 @@ d] <span class="Comment"># takes a pointer into the doubly-linked list, scans back to before start of</span> <span class="Comment"># previous *wrapped* line</span> <span class="Comment"># beware: never return null pointer</span> -<span class="muRecipe">def</span> before-previous-line in:&:duplex-list:char, editor:&:editor-data<span class="muRecipe"> -> </span>out:&:duplex-list:char [ +<span class="muRecipe">def</span> before-previous-line in:&:duplex-list:char, editor:&:editor<span class="muRecipe"> -> </span>out:&:duplex-list:char [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> curr:&:duplex-list:char<span class="Special"> <- </span>copy in @@ -2424,7 +2424,7 @@ d] <span class="Constant">g</span> <span class="Constant">h</span> <span class="Constant">i]</span> - <span class="Constant">2</span>:&:editor-data<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">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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .abcd↩ .</span> @@ -2436,7 +2436,7 @@ d] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2449,7 +2449,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2468,13 +2468,13 @@ d] <span class="Constant">k</span> <span class="Constant">l</span> <span class="Constant">m]</span> - <span class="Constant">2</span>:&:editor-data<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">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="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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2488,7 +2488,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2503,7 +2503,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2518,7 +2518,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2541,7 +2541,7 @@ d] <span class="Constant">g</span> <span class="Constant">h</span> <span class="Constant">i]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .abcde↩ .</span> @@ -2553,7 +2553,7 @@ d] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2566,7 +2566,7 @@ d] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows partial wrapped line</span> screen-should-contain [ @@ -2587,12 +2587,12 @@ d] c d e] - <span class="Constant">2</span>:&:editor-data<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> + <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> assume-console [ press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2604,7 +2604,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2616,7 +2616,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2635,13 +2635,13 @@ e] <span class="Constant">c</span> <span class="Constant">d</span> <span class="Constant">e]</span> - <span class="Constant">2</span>:&:editor-data<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">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="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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2654,9 +2654,9 @@ e] press left-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># screen scrolls</span> screen-should-contain [ @@ -2679,7 +2679,7 @@ e] <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -2694,7 +2694,7 @@ e] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen slides by one line</span> screen-should-contain [ @@ -2708,7 +2708,7 @@ e] press up-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen remains unchanged</span> screen-should-contain [ @@ -2727,7 +2727,7 @@ e] <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -2739,7 +2739,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows next page</span> screen-should-contain [ @@ -2784,7 +2784,7 @@ e] <span class="Comment"># page-down skips entire wrapped lines, so it can't scroll past lines</span> <span class="Comment"># taking up the entire screen</span> -<span class="muRecipe">def</span> page-down editor:&:editor-data<span class="muRecipe"> -> </span>editor:&:editor-data [ +<span class="muRecipe">def</span> page-down editor:&:editor<span class="muRecipe"> -> </span>editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># if editor contents don't overflow screen, do nothing</span> @@ -2812,8 +2812,8 @@ e] 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> <span class="Constant">b]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -2825,7 +2825,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen remains unmodified</span> screen-should-contain [ @@ -2844,7 +2844,7 @@ e] <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-data<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> + <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> <span class="Comment"># some part of last line is not displayed</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -2857,7 +2857,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows entire wrapped line</span> screen-should-contain [ @@ -2875,7 +2875,7 @@ e] <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> <span class="Constant">bcdefgh]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <span class="Comment"># some part of last line is not displayed</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -2888,7 +2888,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows entire wrapped line</span> screen-should-contain [ @@ -2907,7 +2907,7 @@ e] <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -2919,7 +2919,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows next page</span> screen-should-contain [ @@ -2933,7 +2933,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows original page again</span> screen-should-contain [ @@ -2977,7 +2977,7 @@ e] <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> page-up editor:&:editor-data, screen-height:num<span class="muRecipe"> -> </span>editor:&:editor-data [ +<span class="muRecipe">def</span> page-up editor:&:editor, screen-height:num<span class="muRecipe"> -> </span>editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> max:num<span class="Special"> <- </span>subtract screen-height, <span class="Constant">1/menu-bar</span>, <span class="Constant">1/overlapping-line</span> @@ -3007,7 +3007,7 @@ e] <span class="Constant">f</span> <span class="Constant">g</span> <span class="Constant">h]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -3020,7 +3020,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows third page</span> screen-should-contain [ @@ -3034,7 +3034,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows second page</span> screen-should-contain [ @@ -3048,7 +3048,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows original page again</span> screen-should-contain [ @@ -3074,7 +3074,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-data<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> + <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> <span class="Comment"># some part of last line is not displayed</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -3091,7 +3091,7 @@ e] press down-arrow ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows entire wrapped line</span> screen-should-contain [ @@ -3107,7 +3107,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen resets</span> screen-should-contain [ @@ -3127,7 +3127,7 @@ e] <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> <span class="Constant">bcdefgh]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> <span class="Comment"># some part of last line is not displayed</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -3140,7 +3140,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen shows entire wrapped line</span> screen-should-contain [ @@ -3154,7 +3154,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># screen resets</span> screen-should-contain [ @@ -3177,7 +3177,7 @@ e] <span class="Constant">gxx</span> <span class="Constant">hxx</span> <span class="Constant">]</span> - <span class="Constant">2</span>:&:editor-data<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> + <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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .axx .</span> @@ -3188,7 +3188,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -3200,7 +3200,7 @@ e] press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -3213,7 +3213,7 @@ e] press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -3235,7 +3235,7 @@ exy fxy gxy ] - <span class="Constant">2</span>:&:editor-data<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> + <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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .axy .</span> @@ -3246,7 +3246,7 @@ gxy press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -3258,7 +3258,7 @@ gxy press page-down ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -3271,7 +3271,7 @@ gxy press page-up ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] 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 a50eacb9..39b29125 100644 --- a/html/edit/004-programming-environment.mu.html +++ b/html/edit/004-programming-environment.mu.html @@ -45,25 +45,25 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color initial-recipe:text<span class="Special"> <- </span>restore <span class="Constant">[recipes.mu]</span> initial-sandbox:text<span class="Special"> <- </span>new <span class="Constant">[]</span> hide-screen <span class="Constant">0/screen</span> - env:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment <span class="Constant">0/screen</span>, initial-recipe, initial-sandbox + env:&:environment<span class="Special"> <- </span>new-programming-environment <span class="Constant">0/screen</span>, initial-recipe, initial-sandbox render-all <span class="Constant">0/screen</span>, env, render event-loop <span class="Constant">0/screen</span>, <span class="Constant">0/console</span>, env <span class="Comment"># never gets here</span> ] -<span class="muData">container</span> programming-environment-data [ - recipes:&:editor-data - current-sandbox:&:editor-data +<span class="muData">container</span> environment [ + recipes:&:editor + current-sandbox:&:editor sandbox-in-focus?:bool <span class="Comment"># false => cursor in recipes; true => cursor in current-sandbox</span> ] -<span class="muRecipe">def</span> new-programming-environment screen:&:screen, initial-recipe-contents:text, initial-sandbox-contents:text<span class="muRecipe"> -> </span>result:&:programming-environment-data, screen:&:screen [ +<span class="muRecipe">def</span> new-programming-environment screen:&:screen, initial-recipe-contents:text, initial-sandbox-contents:text<span class="muRecipe"> -> </span>result:&:environment, screen:&:screen [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> width:num<span class="Special"> <- </span>screen-width screen height:num<span class="Special"> <- </span>screen-height screen <span class="Comment"># top menu</span> - result<span class="Special"> <- </span>new <span class="Constant">programming-environment-data:type</span> + result<span class="Special"> <- </span>new <span class="Constant">environment:type</span> draw-horizontal screen, <span class="Constant">0</span>, <span class="Constant">0/left</span>, width, <span class="Constant">32/space</span>, <span class="Constant">0/black</span>, <span class="Constant">238/grey</span> button-start:num<span class="Special"> <- </span>subtract width, <span class="Constant">20</span> button-on-screen?:bool<span class="Special"> <- </span>greater-or-equal button-start, <span class="Constant">0</span> @@ -74,21 +74,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color divider:num, _<span class="Special"> <- </span>divide-with-remainder width, <span class="Constant">2</span> draw-vertical screen, divider, <span class="Constant">1/top</span>, height, <span class="Constant">9482/vertical-dotted</span> <span class="Comment"># recipe editor on the left</span> - recipes:&:editor-data<span class="Special"> <- </span>new-editor initial-recipe-contents, screen, <span class="Constant">0/left</span>, divider/right + recipes:&:editor<span class="Special"> <- </span>new-editor initial-recipe-contents, screen, <span class="Constant">0/left</span>, divider/right <span class="Comment"># sandbox editor on the right</span> sandbox-left:num<span class="Special"> <- </span>add divider, <span class="Constant">1</span> - current-sandbox:&:editor-data<span class="Special"> <- </span>new-editor initial-sandbox-contents, screen, sandbox-left, width/right + current-sandbox:&:editor<span class="Special"> <- </span>new-editor initial-sandbox-contents, screen, sandbox-left, width/right *result<span class="Special"> <- </span>put *result, <span class="Constant">recipes:offset</span>, recipes *result<span class="Special"> <- </span>put *result, <span class="Constant">current-sandbox:offset</span>, current-sandbox *result<span class="Special"> <- </span>put *result, <span class="Constant">sandbox-in-focus?:offset</span>, <span class="Constant">0/false</span> <span class="Constant"> <programming-environment-initialization></span> ] -<span class="muRecipe">def</span> event-loop screen:&:screen, console:&:console, env:&:programming-environment-data<span class="muRecipe"> -> </span>screen:&:screen, console:&:console, env:&:programming-environment-data [ +<span class="muRecipe">def</span> event-loop screen:&:screen, console:&:console, env:&:environment<span class="muRecipe"> -> </span>screen:&:screen, console:&:console, env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - recipes:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> - current-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + recipes:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> + current-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> sandbox-in-focus?:bool<span class="Special"> <- </span>get *env, <span class="Constant">sandbox-in-focus?:offset</span> <span class="Comment"># if we fall behind we'll stop updating the screen, but then we have to</span> <span class="Comment"># render the entire screen when we catch up.</span> @@ -220,21 +220,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> resize screen:&:screen, env:&:programming-environment-data<span class="muRecipe"> -> </span>env:&:programming-environment-data, screen:&:screen [ +<span class="muRecipe">def</span> resize screen:&:screen, env:&:environment<span class="muRecipe"> -> </span>env:&:environment, screen:&:screen [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> clear-screen screen <span class="Comment"># update screen dimensions</span> width:num<span class="Special"> <- </span>screen-width screen divider:num, _<span class="Special"> <- </span>divide-with-remainder width, <span class="Constant">2</span> <span class="Comment"># update recipe editor</span> - recipes:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> + recipes:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> right:num<span class="Special"> <- </span>subtract divider, <span class="Constant">1</span> *recipes<span class="Special"> <- </span>put *recipes, <span class="Constant">right:offset</span>, right <span class="Comment"># reset cursor (later we'll try to preserve its position)</span> *recipes<span class="Special"> <- </span>put *recipes, <span class="Constant">cursor-row:offset</span>, <span class="Constant">1</span> *recipes<span class="Special"> <- </span>put *recipes, <span class="Constant">cursor-column:offset</span>, <span class="Constant">0</span> <span class="Comment"># update sandbox editor</span> - current-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + current-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> left:num<span class="Special"> <- </span>add divider, <span class="Constant">1</span> *current-sandbox<span class="Special"> <- </span>put *current-sandbox, <span class="Constant">left:offset</span>, left right:num<span class="Special"> <- </span>subtract width, <span class="Constant">1</span> @@ -247,7 +247,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># Variant of 'render' that updates cursor-row and cursor-column based on</span> <span class="Comment"># before-cursor (rather than the other way around). If before-cursor moves</span> <span class="Comment"># off-screen, it resets cursor-row and cursor-column.</span> -<span class="muRecipe">def</span> render-without-moving-cursor screen:&:screen, editor:&:editor-data<span class="muRecipe"> -> </span>last-row:num, last-column:num, screen:&:screen, editor:&:editor-data [ +<span class="muRecipe">def</span> render-without-moving-cursor screen:&:screen, editor:&:editor<span class="muRecipe"> -> </span>last-row:num, last-column:num, screen:&:screen, editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="muControl">return-unless</span> editor, <span class="Constant">1/top</span>, <span class="Constant">0/left</span>, screen/same-as-ingredient:<span class="Constant">0</span>, editor/same-as-ingredient:<span class="Constant">1</span> @@ -276,7 +276,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color off-screen?:bool<span class="Special"> <- </span>greater-or-equal row, screen-height <span class="muControl">break-if</span> off-screen? <span class="Comment"># if we find old-before-cursor still on the new resized screen, update</span> - <span class="Comment"># editor-data.cursor-row and editor-data.cursor-column based on</span> + <span class="Comment"># editor.cursor-row and editor.cursor-column based on</span> <span class="Comment"># old-before-cursor</span> <span class="Delimiter">{</span> at-cursor?:bool<span class="Special"> <- </span>equal old-before-cursor, prev @@ -334,7 +334,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 <span class="Comment"># focus on both sides</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">1</span> @@ -342,11 +342,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>:&:programming-environment-data - <span class="Constant">4</span>:&:editor-data<span class="Special"> <- </span>get *<span class="Constant">3</span>:&:programming-environment-data, <span class="Constant">recipes:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">4</span>:&:editor-data, <span class="Constant">cursor-column:offset</span> - <span class="Constant">6</span>:&:editor-data<span class="Special"> <- </span>get *<span class="Constant">3</span>:&:programming-environment-data, <span class="Constant">current-sandbox:offset</span> - <span class="Constant">7</span>:num<span class="Special"> <- </span>get *<span class="Constant">6</span>:&:editor-data, <span class="Constant">cursor-column:offset</span> + 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> ] memory-should-contain [ <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -360,8 +360,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 <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> @@ -370,11 +370,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data - <span class="Constant">4</span>:&:editor-data<span class="Special"> <- </span>get *<span class="Constant">3</span>:&:programming-environment-data, <span class="Constant">recipes:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">4</span>:&:editor-data, <span class="Constant">cursor-column:offset</span> - <span class="Constant">6</span>:&:editor-data<span class="Special"> <- </span>get *<span class="Constant">3</span>:&:programming-environment-data, <span class="Constant">current-sandbox:offset</span> - <span class="Constant">7</span>:num<span class="Special"> <- </span>get *<span class="Constant">6</span>:&:editor-data, <span class="Constant">cursor-column:offset</span> + 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> ] screen-should-contain [ <span class="Constant"> . run (F4) . # this line has a different background, but we don't test that yet</span> @@ -405,8 +405,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 ] <span class="Comment"># divider isn't messed up</span> screen-should-contain [ @@ -423,12 +423,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 <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>:&:programming-environment-data + 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 ] @@ -444,7 +444,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[z]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + 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 ] @@ -464,8 +464,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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> <span class="Constant">def]</span> - <span class="Constant">3</span>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊abc .</span> @@ -479,7 +479,7 @@ 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>:&:programming-environment-data + 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 ] @@ -492,7 +492,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] -<span class="muRecipe">def</span> render-all screen:&:screen, env:&:programming-environment-data, <span class="Delimiter">{</span>render-editor: (<span class="muRecipe">recipe</span> (address screen) (address editor-data)<span class="muRecipe"> -> </span>number number (address screen) (address editor-data))<span class="Delimiter">}</span><span class="muRecipe"> -> </span>screen:&:screen, env:&:programming-environment-data [ +<span class="muRecipe">def</span> render-all screen:&:screen, env:&:environment, <span class="Delimiter">{</span>render-editor: (<span class="muRecipe">recipe</span> (address screen) (address editor)<span class="muRecipe"> -> </span>number number (address screen) (address editor))<span class="Delimiter">}</span><span class="muRecipe"> -> </span>screen:&:screen, env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> trace <span class="Constant">10</span>, <span class="Constant">[app]</span>, <span class="Constant">[render all]</span> @@ -516,19 +516,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color screen<span class="Special"> <- </span>render-sandbox-side screen, env, render-editor <span class="Constant"> <render-components-end></span> <span class="Comment">#</span> - recipes:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> - current-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + recipes:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> + current-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> sandbox-in-focus?:bool<span class="Special"> <- </span>get *env, <span class="Constant">sandbox-in-focus?:offset</span> screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env <span class="Comment">#</span> show-screen screen ] -<span class="muRecipe">def</span> render-recipes screen:&:screen, env:&:programming-environment-data, <span class="Delimiter">{</span>render-editor: (<span class="muRecipe">recipe</span> (address screen) (address editor-data)<span class="muRecipe"> -> </span>number number (address screen) (address editor-data))<span class="Delimiter">}</span><span class="muRecipe"> -> </span>screen:&:screen, env:&:programming-environment-data [ +<span class="muRecipe">def</span> render-recipes screen:&:screen, env:&:environment, <span class="Delimiter">{</span>render-editor: (<span class="muRecipe">recipe</span> (address screen) (address editor)<span class="muRecipe"> -> </span>number number (address screen) (address editor))<span class="Delimiter">}</span><span class="muRecipe"> -> </span>screen:&:screen, env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> trace <span class="Constant">11</span>, <span class="Constant">[app]</span>, <span class="Constant">[render recipes]</span> - recipes:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> + recipes:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> <span class="Comment"># render recipes</span> left:num<span class="Special"> <- </span>get *recipes, <span class="Constant">left:offset</span> right:num<span class="Special"> <- </span>get *recipes, <span class="Constant">right:offset</span> @@ -543,10 +543,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># replaced in a later layer</span> -<span class="muRecipe">def</span> render-sandbox-side screen:&:screen, env:&:programming-environment-data, <span class="Delimiter">{</span>render-editor: (<span class="muRecipe">recipe</span> (address screen) (address editor-data)<span class="muRecipe"> -> </span>number number (address screen) (address editor-data))<span class="Delimiter">}</span><span class="muRecipe"> -> </span>screen:&:screen, env:&:programming-environment-data [ +<span class="muRecipe">def</span> render-sandbox-side screen:&:screen, env:&:environment, <span class="Delimiter">{</span>render-editor: (<span class="muRecipe">recipe</span> (address screen) (address editor)<span class="muRecipe"> -> </span>number number (address screen) (address editor))<span class="Delimiter">}</span><span class="muRecipe"> -> </span>screen:&:screen, env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - current-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + current-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> left:num<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">left:offset</span> right:num<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">right:offset</span> row:num, column:num, screen, current-sandbox<span class="Special"> <- </span>call render-editor, screen, current-sandbox @@ -558,7 +558,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color clear-screen-from screen, row, left, left, right ] -<span class="muRecipe">def</span> update-cursor screen:&:screen, recipes:&:editor-data, current-sandbox:&:editor-data, sandbox-in-focus?:bool, env:&:programming-environment-data<span class="muRecipe"> -> </span>screen:&:screen [ +<span class="muRecipe">def</span> update-cursor screen:&:screen, recipes:&:editor, current-sandbox:&:editor, sandbox-in-focus?:bool, env:&:environment<span class="muRecipe"> -> </span>screen:&:screen [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Constant"> <update-cursor-special-cases></span> @@ -644,7 +644,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">{</span> redraw-screen?:bool<span class="Special"> <- </span>equal c, <span class="Constant">12/ctrl-l</span> <span class="muControl">break-unless</span> redraw-screen? - screen<span class="Special"> <- </span>render-all screen, env:&:programming-environment-data, render + screen<span class="Special"> <- </span>render-all screen, env:&:environment, render sync-screen screen <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> <span class="Delimiter">}</span> diff --git a/html/edit/005-sandbox.mu.html b/html/edit/005-sandbox.mu.html index b6585eda..6aea4d1f 100644 --- a/html/edit/005-sandbox.mu.html +++ b/html/edit/005-sandbox.mu.html @@ -48,15 +48,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color initial-recipe:text<span class="Special"> <- </span>restore <span class="Constant">[recipes.mu]</span> initial-sandbox:text<span class="Special"> <- </span>new <span class="Constant">[]</span> hide-screen <span class="Constant">0/screen</span> - env:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment <span class="Constant">0/screen</span>, initial-recipe, initial-sandbox + env:&:environment<span class="Special"> <- </span>new-programming-environment <span class="Constant">0/screen</span>, initial-recipe, initial-sandbox env<span class="Special"> <- </span>restore-sandboxes env render-all <span class="Constant">0/screen</span>, env, render event-loop <span class="Constant">0/screen</span>, <span class="Constant">0/console</span>, env <span class="Comment"># never gets here</span> ] -<span class="muData">container</span> programming-environment-data [ - sandbox:&:sandbox-data <span class="Comment"># list of sandboxes, from top to bottom</span> +<span class="muData">container</span> environment [ + sandbox:&:sandbox <span class="Comment"># list of sandboxes, from top to bottom</span> render-from:num number-of-sandboxes:num ] @@ -65,7 +65,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color *result<span class="Special"> <- </span>put *result, <span class="Constant">render-from:offset</span>, <span class="Constant">-1</span> ] -<span class="muData">container</span> sandbox-data [ +<span class="muData">container</span> sandbox [ data:text response:text <span class="Comment"># coordinates to track clicks</span> @@ -73,7 +73,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color starting-row-on-screen:num code-ending-row-on-screen:num <span class="Comment"># past end of code</span> screen:&:screen <span class="Comment"># prints in the sandbox go here</span> - next-sandbox:&:sandbox-data + next-sandbox:&:sandbox ] <span class="muScenario">scenario</span> run-and-show-results [ @@ -83,13 +83,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 <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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># check that screen prints the results</span> screen-should-contain [ @@ -139,7 +139,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># check that screen prints the results</span> screen-should-contain [ @@ -177,23 +177,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> run-sandboxes env:&:programming-environment-data, screen:&:screen<span class="muRecipe"> -> </span>errors-found?:bool, env:&:programming-environment-data, screen:&:screen [ +<span class="muRecipe">def</span> run-sandboxes env:&:environment, screen:&:screen<span class="muRecipe"> -> </span>errors-found?:bool, env:&:environment, screen:&:screen [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> errors-found?:bool, env, screen<span class="Special"> <- </span>update-recipes env, screen <span class="muControl">return-if</span> errors-found? <span class="Comment"># check contents of right editor (sandbox)</span> <span class="Constant"> <run-sandboxes-begin></span> - current-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + current-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> <span class="Delimiter">{</span> sandbox-contents:text<span class="Special"> <- </span>editor-contents current-sandbox <span class="muControl">break-unless</span> sandbox-contents <span class="Comment"># if contents exist, first save them</span> - <span class="Comment"># run them and turn them into a new sandbox-data</span> - new-sandbox:&:sandbox-data<span class="Special"> <- </span>new <span class="Constant">sandbox-data:type</span> + <span class="Comment"># run them and turn them into a new sandbox</span> + new-sandbox:&:sandbox<span class="Special"> <- </span>new <span class="Constant">sandbox:type</span> *new-sandbox<span class="Special"> <- </span>put *new-sandbox, <span class="Constant">data:offset</span>, sandbox-contents <span class="Comment"># push to head of sandbox list</span> - dest:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + dest:&:sandbox<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> *new-sandbox<span class="Special"> <- </span>put *new-sandbox, <span class="Constant">next-sandbox:offset</span>, dest *env<span class="Special"> <- </span>put *env, <span class="Constant">sandbox:offset</span>, new-sandbox <span class="Comment"># update sandbox count</span> @@ -208,7 +208,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># save all sandboxes before running, just in case we die when running</span> save-sandboxes env <span class="Comment"># run all sandboxes</span> - curr:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + curr:&:sandbox<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> idx:num<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Delimiter">{</span> <span class="muControl">break-unless</span> curr @@ -222,10 +222,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># copy code from recipe editor, persist, load into mu</span> <span class="Comment"># replaced in a later layer (whereupon errors-found? will actually be set)</span> -<span class="muRecipe">def</span> update-recipes env:&:programming-environment-data, screen:&:screen<span class="muRecipe"> -> </span>errors-found?:bool, env:&:programming-environment-data, screen:&:screen [ +<span class="muRecipe">def</span> update-recipes env:&:environment, screen:&:screen<span class="muRecipe"> -> </span>errors-found?:bool, env:&:environment, screen:&:screen [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - recipes:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> + recipes:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> in:text<span class="Special"> <- </span>editor-contents recipes save <span class="Constant">[recipes.mu]</span>, in <span class="Comment"># newlayer: persistence</span> reload in @@ -233,7 +233,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># replaced in a later layer</span> -<span class="muRecipe">def!</span> update-sandbox sandbox:&:sandbox-data, env:&:programming-environment-data, idx:num<span class="muRecipe"> -> </span>sandbox:&:sandbox-data, env:&:programming-environment-data [ +<span class="muRecipe">def!</span> update-sandbox sandbox:&:sandbox, env:&:environment, idx:num<span class="muRecipe"> -> </span>sandbox:&:sandbox, env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> data:text<span class="Special"> <- </span>get *sandbox, <span class="Constant">data:offset</span> @@ -249,13 +249,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color screen<span class="Special"> <- </span>print screen, msg, color, <span class="Constant">238/grey/background</span> ] -<span class="muRecipe">def</span> save-sandboxes env:&:programming-environment-data [ +<span class="muRecipe">def</span> save-sandboxes env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - current-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + current-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> <span class="Comment"># first clear previous versions, in case we deleted some sandbox</span> $system <span class="Constant">[rm lesson/[0-9]</span>* >/dev/null <span class="Constant">2</span>>/dev/null] <span class="Comment"># some shells can't handle '>&'</span> - curr:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + curr:&:sandbox<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> idx:num<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Delimiter">{</span> <span class="muControl">break-unless</span> curr @@ -269,11 +269,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muRecipe">def!</span> render-sandbox-side screen:&:screen, env:&:programming-environment-data, <span class="Delimiter">{</span>render-editor: (<span class="muRecipe">recipe</span> (address screen) (address editor-data)<span class="muRecipe"> -> </span>number number (address screen) (address editor-data))<span class="Delimiter">}</span><span class="muRecipe"> -> </span>screen:&:screen, env:&:programming-environment-data [ +<span class="muRecipe">def!</span> render-sandbox-side screen:&:screen, env:&:environment, <span class="Delimiter">{</span>render-editor: (<span class="muRecipe">recipe</span> (address screen) (address editor)<span class="muRecipe"> -> </span>number number (address screen) (address editor))<span class="Delimiter">}</span><span class="muRecipe"> -> </span>screen:&:screen, env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> trace <span class="Constant">11</span>, <span class="Constant">[app]</span>, <span class="Constant">[render sandbox side]</span> - current-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + current-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> row:num, column:num<span class="Special"> <- </span>copy <span class="Constant">1</span>, <span class="Constant">0</span> left:num<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">left:offset</span> right:num<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">right:offset</span> @@ -288,12 +288,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> <span class="Comment"># render sandboxes</span> draw-horizontal screen, row, left, right, <span class="Constant">9473/horizontal-double</span> - sandbox:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + sandbox:&:sandbox<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> row, screen<span class="Special"> <- </span>render-sandboxes screen, sandbox, left, right, row, render-from clear-rest-of-screen screen, row, left, right ] -<span class="muRecipe">def</span> render-sandboxes screen:&:screen, sandbox:&:sandbox-data, left:num, right:num, row:num, render-from:num, idx:num<span class="muRecipe"> -> </span>row:num, screen:&:screen, sandbox:&:sandbox-data [ +<span class="muRecipe">def</span> render-sandboxes screen:&:screen, sandbox:&:sandbox, left:num, right:num, row:num, render-from:num, idx:num<span class="muRecipe"> -> </span>row:num, screen:&:screen, sandbox:&:sandbox [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="muControl">return-unless</span> sandbox @@ -343,7 +343,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> <end-render-sandbox-reset-hidden></span> <span class="Delimiter">}</span> <span class="Comment"># draw next sandbox</span> - next-sandbox:&:sandbox-data<span class="Special"> <- </span>get *sandbox, <span class="Constant">next-sandbox:offset</span> + next-sandbox:&:sandbox<span class="Special"> <- </span>get *sandbox, <span class="Constant">next-sandbox:offset</span> next-idx:num<span class="Special"> <- </span>add idx, <span class="Constant">1</span> row, screen<span class="Special"> <- </span>render-sandboxes screen, next-sandbox, left, right, row, render-from, next-idx ] @@ -451,20 +451,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># assumes programming environment has no sandboxes; restores them from previous session</span> -<span class="muRecipe">def</span> restore-sandboxes env:&:programming-environment-data<span class="muRecipe"> -> </span>env:&:programming-environment-data [ +<span class="muRecipe">def</span> restore-sandboxes env:&:environment<span class="muRecipe"> -> </span>env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># read all scenarios, pushing them to end of a list of scenarios</span> idx:num<span class="Special"> <- </span>copy <span class="Constant">0</span> - curr:&:sandbox-data<span class="Special"> <- </span>copy <span class="Constant">0</span> - prev:&:sandbox-data<span class="Special"> <- </span>copy <span class="Constant">0</span> + curr:&:sandbox<span class="Special"> <- </span>copy <span class="Constant">0</span> + prev:&:sandbox<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Delimiter">{</span> filename:text<span class="Special"> <- </span>to-text idx contents:text<span class="Special"> <- </span>restore filename <span class="muControl">break-unless</span> contents <span class="Comment"># stop at first error; assuming file didn't exist</span> <span class="Comment"># todo: handle empty sandbox</span> <span class="Comment"># create new sandbox for file</span> - curr<span class="Special"> <- </span>new <span class="Constant">sandbox-data:type</span> + curr<span class="Special"> <- </span>new <span class="Constant">sandbox:type</span> *curr<span class="Special"> <- </span>put *curr, <span class="Constant">data:offset</span>, contents <span class="Constant"> <end-restore-sandbox></span> <span class="Delimiter">{</span> @@ -562,12 +562,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 <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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -587,7 +587,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># check that screen updates the result on the right</span> screen-should-contain [ @@ -610,13 +610,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 <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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># check that it prints a little toy screen</span> screen-should-contain [ @@ -636,7 +636,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] -<span class="muRecipe">def</span> editor-contents editor:&:editor-data<span class="muRecipe"> -> </span>result:text [ +<span class="muRecipe">def</span> editor-contents editor:&:editor<span class="muRecipe"> -> </span>result:text [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> buf:&:buffer<span class="Special"> <- </span>new-buffer <span class="Constant">80</span> @@ -658,14 +658,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> editor-provides-edited-contents [ 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-data<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> + <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> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">2</span> type <span class="Constant">[def]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:text<span class="Special"> <- </span>editor-contents <span class="Constant">2</span>:&:editor-data + 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 ] memory-should-contain [ @@ -679,7 +679,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> - env:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> render-all screen, env, render assume-console [ press enter @@ -700,7 +700,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> - env:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> render-all screen, env, render assume-console [ press enter @@ -723,7 +723,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># we'll not use the recipe-editor's 'bottom' element directly, because later</span> <span class="Comment"># layers will add other stuff to the left side below the editor (error messages)</span> -<span class="muData">container</span> programming-environment-data [ +<span class="muData">container</span> environment [ recipe-bottom:num ] @@ -736,7 +736,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-if</span> sandbox-in-focus? down-arrow?:bool<span class="Special"> <- </span>equal k, <span class="Constant">65516/down-arrow</span> <span class="muControl">break-unless</span> down-arrow? - recipe-editor:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> + recipe-editor:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> recipe-cursor-row:num<span class="Special"> <- </span>get *recipe-editor, <span class="Constant">cursor-row:offset</span> recipe-editor-bottom:num<span class="Special"> <- </span>get *recipe-editor, <span class="Constant">bottom:offset</span> at-bottom-of-editor?:bool<span class="Special"> <- </span>greater-or-equal recipe-cursor-row, recipe-editor-bottom @@ -766,7 +766,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> more-to-scroll? env:&:programming-environment-data, screen:&:screen<span class="muRecipe"> -> </span>result:bool [ +<span class="muRecipe">def</span> more-to-scroll? env:&:environment, screen:&:screen<span class="muRecipe"> -> </span>result:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> recipe-bottom:num<span class="Special"> <- </span>get *env, <span class="Constant">recipe-bottom:offset</span> @@ -778,7 +778,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> - env:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[]</span> render-all screen, env, render assume-console [ <span class="Comment"># add a line</span> @@ -803,7 +803,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> - env:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[ab</span> + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, <span class="Constant">[ab</span> <span class="Constant">cd]</span> render-all screen, env, render assume-console [ @@ -835,13 +835,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 assume-console [ <span class="Comment"># create a sandbox</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -855,7 +855,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>:&:programming-environment-data + 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 ] @@ -873,7 +873,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>:&:programming-environment-data + 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 ] @@ -893,7 +893,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-unless</span> sandbox-in-focus? page-down?:bool<span class="Special"> <- </span>equal k, <span class="Constant">65518/page-down</span> <span class="muControl">break-unless</span> page-down? - sandbox:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + sandbox:&:sandbox<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> <span class="muControl">break-unless</span> sandbox <span class="Comment"># slide down if possible</span> <span class="Delimiter">{</span> @@ -945,12 +945,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># sandbox belonging to 'env' whose next-sandbox is 'in'</span> <span class="Comment"># return 0 if there's no such sandbox, either because 'in' doesn't exist in 'env', or because it's the first sandbox</span> -<span class="muRecipe">def</span> previous-sandbox env:&:programming-environment-data, in:&:sandbox-data<span class="muRecipe"> -> </span>out:&:sandbox-data [ +<span class="muRecipe">def</span> previous-sandbox env:&:environment, in:&:sandbox<span class="muRecipe"> -> </span>out:&:sandbox [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - curr:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + curr:&:sandbox<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> <span class="muControl">return-unless</span> curr, <span class="Constant">0/nil</span> - next:&:sandbox-data<span class="Special"> <- </span>get *curr, <span class="Constant">next-sandbox:offset</span> + next:&:sandbox<span class="Special"> <- </span>get *curr, <span class="Constant">next-sandbox:offset</span> <span class="Delimiter">{</span> <span class="muControl">return-unless</span> next, <span class="Constant">0/nil</span> found?:bool<span class="Special"> <- </span>equal next, in @@ -970,18 +970,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment <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>:&:programming-environment-data + 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 ] @@ -1001,8 +1001,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 <span class="Comment"># create 2 sandboxes</span> assume-console [ press ctrl-n @@ -1011,7 +1011,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[add 1, 1]</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + 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 screen-should-contain [ @@ -1031,7 +1031,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>:&:programming-environment-data + 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 ] @@ -1053,7 +1053,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># just second sandbox displayed</span> screen-should-contain [ @@ -1070,7 +1070,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># no change</span> screen-should-contain [ @@ -1087,7 +1087,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># back to displaying both sandboxes without editor</span> screen-should-contain [ @@ -1106,7 +1106,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>:&:programming-environment-data + 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 ] @@ -1128,7 +1128,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>:&:programming-environment-data + 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 ] @@ -1153,15 +1153,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 <span class="Comment"># create a sandbox</span> assume-console [ press ctrl-n type <span class="Constant">[add 1, 1]</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -1177,7 +1177,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> @@ -1195,7 +1195,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># back to displaying both sandboxes as well as editor</span> screen-should-contain [ @@ -1213,7 +1213,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <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 987f38f9..dd5adf80 100644 --- a/html/edit/006-sandbox-copy.mu.html +++ b/html/edit/006-sandbox-copy.mu.html @@ -48,8 +48,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ press F4 ] - <span class="Constant">3</span>:&:programming-environment-data<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>:&:programming-environment-data + <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 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">3</span>, <span class="Constant">69</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># it copies into editor</span> screen-should-contain [ @@ -83,7 +83,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[0]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -110,8 +110,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ press F4 ] - <span class="Constant">3</span>:&:programming-environment-data<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>:&:programming-environment-data + <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 screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -127,7 +127,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># it copies into editor</span> screen-should-contain [ @@ -145,7 +145,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[0]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -175,14 +175,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># some preconditions for attempting to copy a sandbox</span> -<span class="muRecipe">def</span> should-attempt-copy? click-row:num, click-column:num, env:&:programming-environment-data<span class="muRecipe"> -> </span>result:bool [ +<span class="muRecipe">def</span> should-attempt-copy? click-row:num, click-column:num, env:&:environment<span class="muRecipe"> -> </span>result:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># are we below the sandbox editor?</span> click-sandbox-area?:bool<span class="Special"> <- </span>click-on-sandbox-area? click-row, click-column, env <span class="muControl">reply-unless</span> click-sandbox-area?, <span class="Constant">0/false</span> <span class="Comment"># narrower, is the click in the columns spanning the 'copy' button?</span> - first-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + first-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> assert first-sandbox, <span class="Constant">[!!]</span> sandbox-left-margin:num<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">left:offset</span> sandbox-right-margin:num<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">right:offset</span> @@ -190,19 +190,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color copy-button-vertical-area?:bool<span class="Special"> <- </span>within-range? click-column, copy-button-left, copy-button-right <span class="muControl">reply-unless</span> copy-button-vertical-area?, <span class="Constant">0/false</span> <span class="Comment"># finally, is sandbox editor empty?</span> - current-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + current-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> result<span class="Special"> <- </span>empty-editor? current-sandbox ] -<span class="muRecipe">def</span> try-copy-sandbox click-row:num, env:&:programming-environment-data<span class="muRecipe"> -> </span>clicked-on-copy-button?:bool, env:&:programming-environment-data [ +<span class="muRecipe">def</span> try-copy-sandbox click-row:num, env:&:environment<span class="muRecipe"> -> </span>clicked-on-copy-button?:bool, env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># identify the sandbox to copy, if the click was actually on the 'copy' button</span> - sandbox:&:sandbox-data<span class="Special"> <- </span>find-sandbox env, click-row + sandbox:&:sandbox<span class="Special"> <- </span>find-sandbox env, click-row <span class="muControl">return-unless</span> sandbox, <span class="Constant">0/false</span> clicked-on-copy-button?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> text:text<span class="Special"> <- </span>get *sandbox, <span class="Constant">data:offset</span> - current-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + current-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> current-sandbox<span class="Special"> <- </span>insert-text current-sandbox, text <span class="Comment"># reset scroll</span> *env<span class="Special"> <- </span>put *env, <span class="Constant">render-from:offset</span>, <span class="Constant">-1</span> @@ -210,10 +210,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color *env<span class="Special"> <- </span>put *env, <span class="Constant">sandbox-in-focus?:offset</span>, <span class="Constant">1/true</span> ] -<span class="muRecipe">def</span> find-sandbox env:&:programming-environment-data, click-row:num<span class="muRecipe"> -> </span>result:&:sandbox-data [ +<span class="muRecipe">def</span> find-sandbox env:&:environment, click-row:num<span class="muRecipe"> -> </span>result:&:sandbox [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - curr-sandbox:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + curr-sandbox:&:sandbox<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> <span class="Delimiter">{</span> <span class="muControl">break-unless</span> curr-sandbox start:num<span class="Special"> <- </span>get *curr-sandbox, <span class="Constant">starting-row-on-screen:offset</span> @@ -225,20 +225,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">return</span> <span class="Constant">0/not-found</span> ] -<span class="muRecipe">def</span> click-on-sandbox-area? click-row:num, click-column:num, env:&:programming-environment-data<span class="muRecipe"> -> </span>result:bool [ +<span class="muRecipe">def</span> click-on-sandbox-area? click-row:num, click-column:num, env:&:environment<span class="muRecipe"> -> </span>result:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - current-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + current-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> sandbox-left-margin:num<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">left:offset</span> on-sandbox-side?:bool<span class="Special"> <- </span>greater-or-equal click-column, sandbox-left-margin <span class="muControl">return-unless</span> on-sandbox-side?, <span class="Constant">0/false</span> - first-sandbox:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + first-sandbox:&:sandbox<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> <span class="muControl">return-unless</span> first-sandbox, <span class="Constant">0/false</span> first-sandbox-begins:num<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">starting-row-on-screen:offset</span> result<span class="Special"> <- </span>greater-or-equal click-row, first-sandbox-begins ] -<span class="muRecipe">def</span> empty-editor? editor:&:editor-data<span class="muRecipe"> -> </span>result:bool [ +<span class="muRecipe">def</span> empty-editor? editor:&:editor<span class="muRecipe"> -> </span>result:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> head:&:duplex-list:char<span class="Special"> <- </span>get *editor, <span class="Constant">data:offset</span> @@ -267,8 +267,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ press F4 ] - <span class="Constant">3</span>:&:programming-environment-data<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>:&:programming-environment-data + <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 screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -286,7 +286,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># copy doesn't happen</span> screen-should-contain [ @@ -304,7 +304,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] 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 668faca9..21cb2be6 100644 --- a/html/edit/007-sandbox-delete.mu.html +++ b/html/edit/007-sandbox-delete.mu.html @@ -39,7 +39,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 <span class="Comment"># run a few commands</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">80</span> @@ -48,7 +48,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[add 2, 2]</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment 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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] 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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -114,14 +114,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># some preconditions for attempting to delete a sandbox</span> -<span class="muRecipe">def</span> should-attempt-delete? click-row:num, click-column:num, env:&:programming-environment-data<span class="muRecipe"> -> </span>result:bool [ +<span class="muRecipe">def</span> should-attempt-delete? click-row:num, click-column:num, env:&:environment<span class="muRecipe"> -> </span>result:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># are we below the sandbox editor?</span> click-sandbox-area?:bool<span class="Special"> <- </span>click-on-sandbox-area? click-row, click-column, env <span class="muControl">reply-unless</span> click-sandbox-area?, <span class="Constant">0/false</span> <span class="Comment"># narrower, is the click in the columns spanning the 'copy' button?</span> - first-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + first-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> assert first-sandbox, <span class="Constant">[!!]</span> sandbox-left-margin:num<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">left:offset</span> sandbox-right-margin:num<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">right:offset</span> @@ -129,31 +129,31 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color result<span class="Special"> <- </span>within-range? click-column, delete-button-left, sandbox-right-margin ] -<span class="muRecipe">def</span> try-delete-sandbox click-row:num, env:&:programming-environment-data<span class="muRecipe"> -> </span>clicked-on-delete-button?:bool, env:&:programming-environment-data [ +<span class="muRecipe">def</span> try-delete-sandbox click-row:num, env:&:environment<span class="muRecipe"> -> </span>clicked-on-delete-button?:bool, env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># identify the sandbox to delete, if the click was actually on the 'delete' button</span> - sandbox:&:sandbox-data<span class="Special"> <- </span>find-sandbox env, click-row + sandbox:&:sandbox<span class="Special"> <- </span>find-sandbox env, click-row <span class="muControl">return-unless</span> sandbox, <span class="Constant">0/false</span> clicked-on-delete-button?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> env<span class="Special"> <- </span>delete-sandbox env, sandbox ] -<span class="muRecipe">def</span> delete-sandbox env:&:programming-environment-data, sandbox:&:sandbox-data<span class="muRecipe"> -> </span>env:&:programming-environment-data [ +<span class="muRecipe">def</span> delete-sandbox env:&:environment, sandbox:&:sandbox<span class="muRecipe"> -> </span>env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - curr-sandbox:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + curr-sandbox:&:sandbox<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> first-sandbox?:bool<span class="Special"> <- </span>equal curr-sandbox, sandbox <span class="Delimiter">{</span> <span class="Comment"># first sandbox? pop</span> <span class="muControl">break-unless</span> first-sandbox? - next-sandbox:&:sandbox-data<span class="Special"> <- </span>get *curr-sandbox, <span class="Constant">next-sandbox:offset</span> + next-sandbox:&:sandbox<span class="Special"> <- </span>get *curr-sandbox, <span class="Constant">next-sandbox:offset</span> *env<span class="Special"> <- </span>put *env, <span class="Constant">sandbox:offset</span>, next-sandbox <span class="Delimiter">}</span> <span class="Delimiter">{</span> <span class="Comment"># not first sandbox?</span> <span class="muControl">break-if</span> first-sandbox? - prev-sandbox:&:sandbox-data<span class="Special"> <- </span>copy curr-sandbox + prev-sandbox:&:sandbox<span class="Special"> <- </span>copy curr-sandbox curr-sandbox<span class="Special"> <- </span>get *curr-sandbox, <span class="Constant">next-sandbox:offset</span> <span class="Delimiter">{</span> assert curr-sandbox, <span class="Constant">[sandbox not found! something is wrong.]</span> @@ -164,7 +164,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">loop</span> <span class="Delimiter">}</span> <span class="Comment"># snip sandbox out of its list</span> - next-sandbox:&:sandbox-data<span class="Special"> <- </span>get *curr-sandbox, <span class="Constant">next-sandbox:offset</span> + next-sandbox:&:sandbox<span class="Special"> <- </span>get *curr-sandbox, <span class="Constant">next-sandbox:offset</span> *prev-sandbox<span class="Special"> <- </span>put *prev-sandbox, <span class="Constant">next-sandbox:offset</span>, next-sandbox <span class="Delimiter">}</span> <span class="Comment"># update sandbox count</span> @@ -187,8 +187,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 <span class="Comment"># create 2 sandboxes and scroll to second</span> assume-console [ press ctrl-n @@ -198,7 +198,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press F4 press page-down ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> @@ -213,7 +213,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># second sandbox shows in editor; scroll resets to display first sandbox</span> screen-should-contain [ @@ -233,8 +233,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 <span class="Comment"># create 2 sandboxes and scroll to second</span> assume-console [ press ctrl-n @@ -244,7 +244,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press F4 press page-down ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> @@ -259,7 +259,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># second sandbox shows in editor; scroll resets to display first sandbox</span> screen-should-contain [ @@ -279,8 +279,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 <span class="Comment"># create 2 sandboxes and scroll to second</span> assume-console [ press ctrl-n @@ -291,7 +291,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down press page-down ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> @@ -306,7 +306,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># implicitly scroll up to first sandbox</span> screen-should-contain [ @@ -327,8 +327,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 <span class="Comment"># create 2 sandboxes</span> assume-console [ press ctrl-n @@ -337,7 +337,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[add 1, 1]</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -357,7 +357,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <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 1fcf071f..b7fbe660 100644 --- a/html/edit/008-sandbox-edit.mu.html +++ b/html/edit/008-sandbox-edit.mu.html @@ -47,8 +47,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ press F4 ] - <span class="Constant">3</span>:&:programming-environment-data<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>:&:programming-environment-data + <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 screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -64,7 +64,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># it pops back into editor</span> screen-should-contain [ @@ -81,7 +81,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[0]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -107,8 +107,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ press F4 ] - <span class="Constant">3</span>:&:programming-environment-data<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>:&:programming-environment-data + <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 screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -124,7 +124,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># it pops back into editor</span> screen-should-contain [ @@ -141,7 +141,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[0]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -170,14 +170,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># some preconditions for attempting to edit a sandbox</span> -<span class="muRecipe">def</span> should-attempt-edit? click-row:num, click-column:num, env:&:programming-environment-data<span class="muRecipe"> -> </span>result:bool [ +<span class="muRecipe">def</span> should-attempt-edit? click-row:num, click-column:num, env:&:environment<span class="muRecipe"> -> </span>result:bool [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># are we below the sandbox editor?</span> click-sandbox-area?:bool<span class="Special"> <- </span>click-on-sandbox-area? click-row, click-column, env <span class="muControl">reply-unless</span> click-sandbox-area?, <span class="Constant">0/false</span> <span class="Comment"># narrower, is the click in the columns spanning the 'edit' button?</span> - first-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + first-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> assert first-sandbox, <span class="Constant">[!!]</span> sandbox-left-margin:num<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">left:offset</span> sandbox-right-margin:num<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">right:offset</span> @@ -185,20 +185,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color edit-button-vertical-area?:bool<span class="Special"> <- </span>within-range? click-column, edit-button-left, edit-button-right <span class="muControl">reply-unless</span> edit-button-vertical-area?, <span class="Constant">0/false</span> <span class="Comment"># finally, is sandbox editor empty?</span> - current-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + current-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> result<span class="Special"> <- </span>empty-editor? current-sandbox ] -<span class="muRecipe">def</span> try-edit-sandbox click-row:num, env:&:programming-environment-data<span class="muRecipe"> -> </span>clicked-on-edit-button?:bool, env:&:programming-environment-data [ +<span class="muRecipe">def</span> try-edit-sandbox click-row:num, env:&:environment<span class="muRecipe"> -> </span>clicked-on-edit-button?:bool, env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># identify the sandbox to edit, if the click was actually on the 'edit' button</span> - sandbox:&:sandbox-data<span class="Special"> <- </span>find-sandbox env, click-row + sandbox:&:sandbox<span class="Special"> <- </span>find-sandbox env, click-row <span class="muControl">return-unless</span> sandbox, <span class="Constant">0/false</span> clicked-on-edit-button?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> <span class="Comment"># 'edit' button = 'copy' button + 'delete' button</span> text:text<span class="Special"> <- </span>get *sandbox, <span class="Constant">data:offset</span> - current-sandbox:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + current-sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> current-sandbox<span class="Special"> <- </span>insert-text current-sandbox, text env<span class="Special"> <- </span>delete-sandbox env, sandbox <span class="Comment"># reset scroll</span> @@ -214,12 +214,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 <span class="Comment"># run the sandbox</span> assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment 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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -257,8 +257,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 <span class="Comment"># create 2 sandboxes and scroll to second</span> assume-console [ press ctrl-n @@ -269,7 +269,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press page-down press page-down ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> @@ -284,7 +284,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># second sandbox shows in editor; scroll resets to display first sandbox</span> screen-should-contain [ @@ -305,8 +305,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<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>:&:programming-environment-data, render + <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 <span class="Comment"># create 2 sandboxes</span> assume-console [ press ctrl-n @@ -315,7 +315,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[add 1, 1]</span> press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -334,7 +334,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># no change in contents</span> screen-should-contain [ @@ -356,7 +356,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <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 1967fa7d..579c4cf2 100644 --- a/html/edit/009-sandbox-test.mu.html +++ b/html/edit/009-sandbox-test.mu.html @@ -48,8 +48,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ press F4 ] - <span class="Constant">3</span>:&:programming-environment-data<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>:&:programming-environment-data + <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 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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># color toggles to green</span> screen-should-contain-in-color <span class="Constant">2/green</span>, [ @@ -104,7 +104,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># result turns red</span> screen-should-contain-in-color <span class="Constant">1/red</span>, [ @@ -120,7 +120,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># this requires tracking a couple more things</span> -<span class="muData">container</span> sandbox-data [ +<span class="muData">container</span> sandbox [ response-starting-row-on-screen:num expected-response:text ] @@ -152,14 +152,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color click-column:num<span class="Special"> <- </span>get t, <span class="Constant">column:offset</span> on-sandbox-side?:bool<span class="Special"> <- </span>greater-or-equal click-column, sandbox-left-margin <span class="muControl">break-unless</span> on-sandbox-side? - first-sandbox:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + first-sandbox:&:sandbox<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> <span class="muControl">break-unless</span> first-sandbox first-sandbox-begins:num<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">starting-row-on-screen:offset</span> click-row:num<span class="Special"> <- </span>get t, <span class="Constant">row:offset</span> below-sandbox-editor?:bool<span class="Special"> <- </span>greater-or-equal click-row, first-sandbox-begins <span class="muControl">break-unless</span> below-sandbox-editor? <span class="Comment"># identify the sandbox whose output is being clicked on</span> - sandbox:&:sandbox-data<span class="Special"> <- </span>find-click-in-sandbox-output env, click-row + sandbox:&:sandbox<span class="Special"> <- </span>find-click-in-sandbox-output env, click-row <span class="muControl">break-unless</span> sandbox <span class="Comment"># toggle its expected-response, and save session</span> sandbox<span class="Special"> <- </span>toggle-expected-response sandbox @@ -173,17 +173,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> find-click-in-sandbox-output env:&:programming-environment-data, click-row:num<span class="muRecipe"> -> </span>sandbox:&:sandbox-data [ +<span class="muRecipe">def</span> find-click-in-sandbox-output env:&:environment, click-row:num<span class="muRecipe"> -> </span>sandbox:&:sandbox [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># assert click-row >= sandbox.starting-row-on-screen</span> - sandbox:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + sandbox:&:sandbox<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> start:num<span class="Special"> <- </span>get *sandbox, <span class="Constant">starting-row-on-screen:offset</span> clicked-on-sandboxes?:bool<span class="Special"> <- </span>greater-or-equal click-row, start assert clicked-on-sandboxes?, <span class="Constant">[extract-sandbox called on click to sandbox editor]</span> <span class="Comment"># while click-row < sandbox.next-sandbox.starting-row-on-screen</span> <span class="Delimiter">{</span> - next-sandbox:&:sandbox-data<span class="Special"> <- </span>get *sandbox, <span class="Constant">next-sandbox:offset</span> + next-sandbox:&:sandbox<span class="Special"> <- </span>get *sandbox, <span class="Constant">next-sandbox:offset</span> <span class="muControl">break-unless</span> next-sandbox next-start:num<span class="Special"> <- </span>get *next-sandbox, <span class="Constant">starting-row-on-screen:offset</span> found?:bool<span class="Special"> <- </span>lesser-than click-row, next-start @@ -199,7 +199,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">return</span> sandbox ] -<span class="muRecipe">def</span> toggle-expected-response sandbox:&:sandbox-data<span class="muRecipe"> -> </span>sandbox:&:sandbox-data [ +<span class="muRecipe">def</span> toggle-expected-response sandbox:&:sandbox<span class="muRecipe"> -> </span>sandbox:&:sandbox [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> expected-response:text<span class="Special"> <- </span>get *sandbox, <span class="Constant">expected-response:offset</span> diff --git a/html/edit/010-sandbox-trace.mu.html b/html/edit/010-sandbox-trace.mu.html index 25c8ff32..5ab47bb0 100644 --- a/html/edit/010-sandbox-trace.mu.html +++ b/html/edit/010-sandbox-trace.mu.html @@ -48,8 +48,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ press F4 ] - <span class="Constant">3</span>:&:programming-environment-data<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>:&:programming-environment-data + <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 screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -64,7 +64,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>:&:programming-environment-data + 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 ] @@ -90,7 +90,7 @@ 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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment print screen:&:screen, <span class="Constant">4</span>:char/cursor-icon ] <span class="Comment"># trace hidden again</span> @@ -119,8 +119,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ press F4 ] - <span class="Constant">3</span>:&:programming-environment-data<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>:&:programming-environment-data + <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 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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># trace now printed above result</span> screen-should-contain [ @@ -163,8 +163,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press F4 left-click <span class="Constant">4</span>, <span class="Constant">51</span> ] - <span class="Constant">3</span>:&:programming-environment-data<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>:&:programming-environment-data + <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 screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -178,7 +178,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># no change; doesn't die</span> screen-should-contain [ @@ -191,13 +191,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] -<span class="muData">container</span> sandbox-data [ +<span class="muData">container</span> sandbox [ trace:text display-trace?:bool ] <span class="Comment"># replaced in a later layer</span> -<span class="muRecipe">def!</span> update-sandbox sandbox:&:sandbox-data, env:&:programming-environment-data, idx:num<span class="muRecipe"> -> </span>sandbox:&:sandbox-data, env:&:programming-environment-data [ +<span class="muRecipe">def!</span> update-sandbox sandbox:&:sandbox, env:&:environment, idx:num<span class="muRecipe"> -> </span>sandbox:&:sandbox, env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> data:text<span class="Special"> <- </span>get *sandbox, <span class="Constant">data:offset</span> @@ -215,14 +215,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color click-column:num<span class="Special"> <- </span>get t, <span class="Constant">column:offset</span> on-sandbox-side?:bool<span class="Special"> <- </span>greater-or-equal click-column, sandbox-left-margin <span class="muControl">break-unless</span> on-sandbox-side? - first-sandbox:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + first-sandbox:&:sandbox<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> <span class="muControl">break-unless</span> first-sandbox first-sandbox-begins:num<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">starting-row-on-screen:offset</span> click-row:num<span class="Special"> <- </span>get t, <span class="Constant">row:offset</span> below-sandbox-editor?:bool<span class="Special"> <- </span>greater-or-equal click-row, first-sandbox-begins <span class="muControl">break-unless</span> below-sandbox-editor? <span class="Comment"># identify the sandbox whose code is being clicked on</span> - sandbox:&:sandbox-data<span class="Special"> <- </span>find-click-in-sandbox-code env, click-row + sandbox:&:sandbox<span class="Special"> <- </span>find-click-in-sandbox-code env, click-row <span class="muControl">break-unless</span> sandbox <span class="Comment"># toggle its display-trace? property</span> x:bool<span class="Special"> <- </span>get *sandbox, <span class="Constant">display-trace?:offset</span> @@ -237,7 +237,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> find-click-in-sandbox-code env:&:programming-environment-data, click-row:num<span class="muRecipe"> -> </span>sandbox:&:sandbox-data [ +<span class="muRecipe">def</span> find-click-in-sandbox-code env:&:environment, click-row:num<span class="muRecipe"> -> </span>sandbox:&:sandbox [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># assert click-row >= sandbox.starting-row-on-screen</span> @@ -247,7 +247,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assert clicked-on-sandboxes?, <span class="Constant">[extract-sandbox called on click to sandbox editor]</span> <span class="Comment"># while click-row < sandbox.next-sandbox.starting-row-on-screen</span> <span class="Delimiter">{</span> - next-sandbox:&:sandbox-data<span class="Special"> <- </span>get *sandbox, <span class="Constant">next-sandbox:offset</span> + next-sandbox:&:sandbox<span class="Special"> <- </span>get *sandbox, <span class="Constant">next-sandbox:offset</span> <span class="muControl">break-unless</span> next-sandbox next-start:num<span class="Special"> <- </span>get *next-sandbox, <span class="Constant">starting-row-on-screen:offset</span> found?:bool<span class="Special"> <- </span>lesser-than click-row, next-start diff --git a/html/edit/011-errors.mu.html b/html/edit/011-errors.mu.html index 771be1b6..990dd470 100644 --- a/html/edit/011-errors.mu.html +++ b/html/edit/011-errors.mu.html @@ -35,15 +35,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <pre id='vimCodeElement'> <span class="SalientComment">## handling malformed programs</span> -<span class="muData">container</span> programming-environment-data [ +<span class="muData">container</span> environment [ recipe-errors:text ] <span class="Comment"># copy code from recipe editor, persist, load into mu, save any errors</span> -<span class="muRecipe">def!</span> update-recipes env:&:programming-environment-data, screen:&:screen<span class="muRecipe"> -> </span>errors-found?:bool, env:&:programming-environment-data, screen:&:screen [ +<span class="muRecipe">def!</span> update-recipes env:&:environment, screen:&:screen<span class="muRecipe"> -> </span>errors-found?:bool, env:&:environment, screen:&:screen [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - recipes:&:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> + recipes:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> in:text<span class="Special"> <- </span>editor-contents recipes save <span class="Constant">[recipes.mu]</span>, in recipe-errors:text<span class="Special"> <- </span>reload in @@ -75,7 +75,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muData">container</span> programming-environment-data [ +<span class="muData">container</span> environment [ error-index:num <span class="Comment"># index of first sandbox with an error (or -1 if none)</span> ] @@ -108,11 +108,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muData">container</span> sandbox-data [ +<span class="muData">container</span> sandbox [ errors:text ] -<span class="muRecipe">def!</span> update-sandbox sandbox:&:sandbox-data, env:&:programming-environment-data, idx:num<span class="muRecipe"> -> </span>sandbox:&:sandbox-data, env:&:programming-environment-data [ +<span class="muRecipe">def!</span> update-sandbox sandbox:&:sandbox, env:&:environment, idx:num<span class="muRecipe"> -> </span>sandbox:&:sandbox, env:&:environment [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> data:text<span class="Special"> <- </span>get *sandbox, <span class="Constant">data:offset</span> @@ -157,12 +157,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> @@ -194,7 +194,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">80</span> <span class="Comment"># create invalid sandbox 1</span> @@ -205,7 +205,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># status line shows that error is in first sandbox</span> screen-should-contain [ @@ -218,7 +218,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">80</span> <span class="Comment"># create invalid sandbox 2</span> @@ -232,7 +232,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># status line shows that error is in second sandbox</span> screen-should-contain [ @@ -245,12 +245,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 assume-console [ press F4 <span class="Comment"># generate error</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">58</span> @@ -259,7 +259,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press F4 <span class="Comment"># update sandbox</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># error should disappear</span> screen-should-contain [ @@ -285,11 +285,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment screen-should-contain [ <span class="Constant"> . errors found (0) run (F4) .</span> <span class="Constant"> .recipe foo x:_elem -> z:_elem [ ┊ .</span> @@ -306,7 +306,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># error should remain unchanged</span> screen-should-contain [ @@ -331,12 +331,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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> <span class="Constant">to-text x]</span> - <span class="Constant">3</span>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 <span class="Comment"># run it once</span> assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment <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 +360,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># still no errors</span> screen-should-contain-in-color <span class="Constant">1/red</span>, [ @@ -390,12 +390,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> @@ -416,12 +416,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> @@ -445,12 +445,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> @@ -478,12 +478,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> @@ -511,11 +511,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> <span class="Constant"> . ┊foo .</span> @@ -532,7 +532,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . errors found run (F4) .</span> @@ -554,13 +554,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 <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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># check that screen prints error message in red</span> screen-should-contain [ @@ -617,14 +617,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 <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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <span class="Comment"># check that screen prints error message just once</span> screen-should-contain [ @@ -652,13 +652,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 <span class="Comment"># run the sandbox</span> assume-console [ press F4 ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] screen-should-contain [ <span class="Constant"> . errors found (0) run (F4) .</span> @@ -685,12 +685,12 @@ _, 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>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + <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 <span class="Comment"># run</span> assume-console [ press F4 ] - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment <span class="Comment"># screen prints error message</span> screen-should-contain [ <span class="Constant"> . errors found (0) run (F4) .</span> @@ -708,7 +708,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>:&:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment ] <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 0233a08a..45abb7e9 100644 --- a/html/edit/012-editor-undo.mu.html +++ b/html/edit/012-editor-undo.mu.html @@ -90,7 +90,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># every editor accumulates a list of operations to undo/redo</span> -<span class="muData">container</span> editor-data [ +<span class="muData">container</span> editor [ undo:&:list:&:operation redo:&:list:&:operation ] @@ -137,18 +137,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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-data<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-data + <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 assume-console [ type <span class="Constant">[0]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># character should be gone</span> screen-should-contain [ @@ -162,7 +162,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -232,7 +232,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># redo stack, because it's now obsolete.</span> <span class="Comment"># Beware: since we're counting cursor moves as operations, this means just</span> <span class="Comment"># moving the cursor can lose work on the undo stack.</span> -<span class="muRecipe">def</span> add-operation editor:&:editor-data, op:&:operation<span class="muRecipe"> -> </span>editor:&:editor-data [ +<span class="muRecipe">def</span> add-operation editor:&:editor, op:&:operation<span class="muRecipe"> -> </span>editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> undo:&:list:&:operation<span class="Special"> <- </span>get *editor, <span class="Constant">undo:offset</span> @@ -267,18 +267,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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-data<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-data + <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 assume-console [ type <span class="Constant">[012]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># all characters must be gone</span> screen-should-contain [ @@ -293,13 +293,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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-data<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-data + <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 <span class="Comment"># type some characters</span> assume-console [ type <span class="Constant">[012]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor 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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># back to original text</span> screen-should-contain [ @@ -325,7 +325,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[3]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -339,14 +339,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor 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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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-data + 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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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> @@ -386,7 +386,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -402,13 +402,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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-data<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-data + <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 assume-console [ type <span class="Constant">[012]</span> press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor 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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># all characters must be back</span> screen-should-contain [ @@ -434,7 +434,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[3]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -466,13 +466,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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-data<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-data + <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 assume-console [ type <span class="Constant">[012]</span> press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor 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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># all characters must be back</span> screen-should-contain [ @@ -498,7 +498,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[3]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -514,18 +514,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 assume-console [ type <span class="Constant">[1]</span> press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># do some more work</span> assume-console [ type <span class="Constant">[0]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .0abc .</span> @@ -538,7 +538,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># nothing should happen</span> screen-should-contain [ @@ -554,8 +554,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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-data<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-data + <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 <span class="Comment"># insert some text and tabs, hit enter, some more text and tabs</span> assume-console [ press tab @@ -566,7 +566,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press tab type <span class="Constant">[efg]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> . ab cd .</span> @@ -574,8 +574,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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +585,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +606,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +626,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># empty screen</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +646,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># first line inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +666,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +687,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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> @@ -713,21 +713,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># click undone</span> memory-should-contain [ @@ -739,7 +739,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -804,15 +804,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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">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="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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> <span class="Comment"># screen scrolls</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -829,9 +829,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moved back</span> memory-should-contain [ @@ -850,7 +850,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -866,22 +866,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves back</span> memory-should-contain [ @@ -893,7 +893,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -910,16 +910,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 <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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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,9 +929,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves back</span> memory-should-contain [ @@ -943,7 +943,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -960,22 +960,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves back</span> memory-should-contain [ @@ -987,7 +987,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1007,21 +1007,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># screen should again show page 1</span> screen-should-contain [ @@ -1042,21 +1042,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># screen should again show page 1</span> screen-should-contain [ @@ -1077,22 +1077,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># screen should again show page 2</span> screen-should-contain [ @@ -1113,22 +1113,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># screen should again show page 2</span> screen-should-contain [ @@ -1146,22 +1146,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves back</span> memory-should-contain [ @@ -1173,7 +1173,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1190,22 +1190,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves back</span> memory-should-contain [ @@ -1217,7 +1217,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1234,22 +1234,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves back</span> memory-should-contain [ @@ -1261,7 +1261,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1278,22 +1278,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves back</span> memory-should-contain [ @@ -1305,7 +1305,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1322,8 +1322,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 <span class="Comment"># move the cursor</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> @@ -1331,9 +1331,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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,9 +1343,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># up-arrow is undone</span> memory-should-contain [ @@ -1357,9 +1357,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># both right-arrows are undone</span> memory-should-contain [ @@ -1376,21 +1376,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">1</span>: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-data<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-data + <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 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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor <span class="Comment"># redo</span> assume-console [ press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves to left-click</span> memory-should-contain [ @@ -1402,7 +1402,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1431,16 +1431,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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-data<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-data + <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 assume-console [ type <span class="Constant">[abc]</span> left-click <span class="Constant">1</span>, <span class="Constant">1</span> type <span class="Constant">[d]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .adbc .</span> @@ -1456,9 +1456,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># last letter typed is deleted</span> screen-should-contain [ @@ -1476,9 +1476,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># no change to screen; cursor moves</span> screen-should-contain [ @@ -1496,9 +1496,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># screen empty</span> screen-should-contain [ @@ -1516,9 +1516,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># first insert</span> screen-should-contain [ @@ -1536,9 +1536,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># cursor moves</span> screen-should-contain [ @@ -1557,9 +1557,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-data - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> ] <span class="Comment"># second insert</span> screen-should-contain [ @@ -1580,23 +1580,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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-data<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-data + <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 <span class="Comment"># insert some text and hit backspace</span> assume-console [ type <span class="Constant">[abc]</span> press backspace press backspace ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor 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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +1606,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-data + 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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +1625,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-data + 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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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> @@ -1725,8 +1725,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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-data<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-data + <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 <span class="Comment"># insert some text and hit delete and backspace a few times</span> assume-console [ type <span class="Constant">[abcdef]</span> @@ -1736,15 +1736,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press delete press delete ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor 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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +1754,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-data + 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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +1773,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-data + 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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +1792,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-data + 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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +1811,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># first line inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +1831,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># first line inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +1851,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># first line inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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> @@ -1915,14 +1915,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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">def]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -1930,8 +1930,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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +1941,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1950,8 +1950,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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +1961,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># first line inserted</span> screen-should-contain [ @@ -1971,8 +1971,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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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> @@ -1982,7 +1982,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2017,14 +2017,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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">def]</span> - <span class="Constant">2</span>:&:editor-data<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-data + <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 <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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .c .</span> @@ -2032,8 +2032,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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +2043,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2052,8 +2052,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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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 +2063,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-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] <span class="Comment"># first line inserted</span> screen-should-contain [ @@ -2073,8 +2073,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-data, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor-data, <span class="Constant">cursor-column:offset</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> 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> @@ -2084,7 +2084,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color type <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2117,15 +2117,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <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-data<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-data + <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 <span class="Comment"># insert some text and hit delete and backspace a few times</span> assume-console [ type <span class="Constant">[abc]</span> press ctrl-u press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor-data + editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .abc .</span> |