diff options
Diffstat (limited to 'html/edit')
-rw-r--r-- | html/edit/001-editor.mu.html | 25 | ||||
-rw-r--r-- | html/edit/002-typing.mu.html | 2 | ||||
-rw-r--r-- | html/edit/004-programming-environment.mu.html | 10 | ||||
-rw-r--r-- | html/edit/005-sandbox.mu.html | 423 | ||||
-rw-r--r-- | html/edit/006-sandbox-copy.mu.html | 322 | ||||
-rw-r--r-- | html/edit/006-sandbox-edit.mu.html | 339 | ||||
-rw-r--r-- | html/edit/007-sandbox-delete.mu.html | 257 | ||||
-rw-r--r-- | html/edit/008-sandbox-edit.mu.html | 375 | ||||
-rw-r--r-- | html/edit/009-sandbox-test.mu.html (renamed from html/edit/008-sandbox-test.mu.html) | 79 | ||||
-rw-r--r-- | html/edit/010-sandbox-trace.mu.html (renamed from html/edit/009-sandbox-trace.mu.html) | 106 | ||||
-rw-r--r-- | html/edit/011-errors.mu.html (renamed from html/edit/010-errors.mu.html) | 56 | ||||
-rw-r--r-- | html/edit/012-editor-undo.mu.html (renamed from html/edit/011-editor-undo.mu.html) | 4 |
12 files changed, 1186 insertions, 812 deletions
diff --git a/html/edit/001-editor.mu.html b/html/edit/001-editor.mu.html index 62f21806..6118097e 100644 --- a/html/edit/001-editor.mu.html +++ b/html/edit/001-editor.mu.html @@ -207,7 +207,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color before-cursor<span class="Special"> <- </span>prev curr <span class="Delimiter">}</span> <span class="Comment"># clear rest of line in this window</span> - clear-line-delimited screen, column, right + clear-line-until screen, right <span class="Comment"># skip to next line</span> row<span class="Special"> <- </span>add row, <span class="Constant">1</span> column<span class="Special"> <- </span>copy left @@ -257,25 +257,6 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">return</span> row, column, screen/same-as-ingredient:<span class="Constant">0</span>, editor/same-as-ingredient:<span class="Constant">1</span> ] -<span class="muRecipe">def</span> clear-line-delimited screen:address:screen, column:number, right:number<span class="muRecipe"> -> </span>screen:address:screen [ - <span class="Constant">local-scope</span> - <span class="Constant">load-ingredients</span> - space:character<span class="Special"> <- </span>copy <span class="Constant">32/space</span> - bg-color:number, bg-color-found?:boolean<span class="Special"> <- </span><span class="Constant">next-ingredient</span> - <span class="Delimiter">{</span> - <span class="Comment"># default bg-color to black</span> - <span class="muControl">break-if</span> bg-color-found? - bg-color<span class="Special"> <- </span>copy <span class="Constant">0/black</span> - <span class="Delimiter">}</span> - <span class="Delimiter">{</span> - done?:boolean<span class="Special"> <- </span>greater-than column, right - <span class="muControl">break-if</span> done? - screen<span class="Special"> <- </span>print screen, space, <span class="Constant">7/white</span>, bg-color <span class="Comment"># foreground color is mostly unused except if the cursor shows up at this cell</span> - column<span class="Special"> <- </span>add column, <span class="Constant">1</span> - <span class="muControl">loop</span> - <span class="Delimiter">}</span> -] - <span class="muRecipe">def</span> clear-screen-from screen:address:screen, row:number, column:number, left:number, right:number<span class="muRecipe"> -> </span>screen:address:screen [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> @@ -287,7 +268,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> <span class="Comment"># if not, go the slower route</span> screen<span class="Special"> <- </span>move-cursor screen, row, column - clear-line-delimited screen, column, right + clear-line-until screen, right clear-rest-of-screen screen, row, left, right <span class="muControl">return</span> screen/same-as-ingredient:<span class="Constant">0</span> ] @@ -302,7 +283,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color at-bottom-of-screen?:boolean<span class="Special"> <- </span>greater-or-equal row, screen-height <span class="muControl">break-if</span> at-bottom-of-screen? screen<span class="Special"> <- </span>move-cursor screen, row, left - clear-line-delimited screen, left, right + clear-line-until screen, right row<span class="Special"> <- </span>add row, <span class="Constant">1</span> <span class="muControl">loop</span> <span class="Delimiter">}</span> diff --git a/html/edit/002-typing.mu.html b/html/edit/002-typing.mu.html index a9f02220..7375cd90 100644 --- a/html/edit/002-typing.mu.html +++ b/html/edit/002-typing.mu.html @@ -308,7 +308,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left:number<span class="Special"> <- </span>get *editor, <span class="Constant">left:offset</span> right:number<span class="Special"> <- </span>get *editor, <span class="Constant">right:offset</span> row:number, column:number<span class="Special"> <- </span>render screen, editor - clear-line-delimited screen, column, right + clear-line-until screen, right row<span class="Special"> <- </span>add row, <span class="Constant">1</span> draw-horizontal screen, row, left, right, <span class="Constant">9480/horizontal-dotted</span> row<span class="Special"> <- </span>add row, <span class="Constant">1</span> diff --git a/html/edit/004-programming-environment.mu.html b/html/edit/004-programming-environment.mu.html index c05d0127..6ae14e6c 100644 --- a/html/edit/004-programming-environment.mu.html +++ b/html/edit/004-programming-environment.mu.html @@ -121,6 +121,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color touch-type:number<span class="Special"> <- </span>get t, <span class="Constant">type:offset</span> is-left-click?:boolean<span class="Special"> <- </span>equal touch-type, <span class="Constant">65513/mouse-left</span> <span class="muControl">loop-unless</span> is-left-click?, <span class="Constant">+next-event:label</span> + click-row:number<span class="Special"> <- </span>get t, <span class="Constant">row:offset</span> + click-column:number<span class="Special"> <- </span>get t, <span class="Constant">column:offset</span> <span class="Comment"># later exceptions for non-editor touches will go here</span> <span class="Constant"> <global-touch></span> <span class="Comment"># send to both editors</span> @@ -446,7 +448,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left:number<span class="Special"> <- </span>get *recipes, <span class="Constant">left:offset</span> right:number<span class="Special"> <- </span>get *recipes, <span class="Constant">right:offset</span> row:number, column:number, screen<span class="Special"> <- </span>render screen, recipes - clear-line-delimited screen, column, right + clear-line-until screen, right row<span class="Special"> <- </span>add row, <span class="Constant">1</span> <span class="Constant"> <render-recipe-components-end></span> <span class="Comment"># draw dotted line after recipes</span> @@ -463,7 +465,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left:number<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">left:offset</span> right:number<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">right:offset</span> row:number, column:number, screen, current-sandbox<span class="Special"> <- </span>render screen, current-sandbox - clear-line-delimited screen, column, right + clear-line-until screen, right row<span class="Special"> <- </span>add row, <span class="Constant">1</span> <span class="Comment"># draw solid line after code (you'll see why in later layers)</span> draw-horizontal screen, row, left, right, <span class="Constant">9473/horizontal</span> @@ -542,7 +544,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">loop</span> <span class="Delimiter">}</span> was-at-left?:boolean<span class="Special"> <- </span>equal column, left - clear-line-delimited screen, column, right + clear-line-until screen, right <span class="Delimiter">{</span> <span class="muControl">break-if</span> was-at-left? row<span class="Special"> <- </span>add row, <span class="Constant">1</span> @@ -605,7 +607,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">loop</span> <span class="Delimiter">}</span> was-at-left?:boolean<span class="Special"> <- </span>equal column, left - clear-line-delimited screen, column, right + clear-line-until screen, right <span class="Delimiter">{</span> <span class="muControl">break-if</span> was-at-left? row<span class="Special"> <- </span>add row, <span class="Constant">1</span> diff --git a/html/edit/005-sandbox.mu.html b/html/edit/005-sandbox.mu.html index 660791b8..e3523d27 100644 --- a/html/edit/005-sandbox.mu.html +++ b/html/edit/005-sandbox.mu.html @@ -38,6 +38,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># Running code in the sandbox editor prepends its contents to a list of</span> <span class="Comment"># (non-editable) sandboxes below the editor, showing the result and a maybe</span> <span class="Comment"># few other things.</span> +<span class="Comment">#</span> +<span class="Comment"># This layer draws the menubar buttons non-editable sandboxes but they don't</span> +<span class="Comment"># do anything yet. Later layers implement each button.</span> <span class="muRecipe">def!</span> main [ <span class="Constant">local-scope</span> @@ -93,7 +96,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> <span class="Constant"> . ┊divide-with-remainder 11, 3 .</span> <span class="Constant"> . ┊3 .</span> <span class="Constant"> . ┊2 .</span> @@ -115,19 +118,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ x.</span> + <span class="Constant"> . ┊ .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> . ┊3 .</span> <span class="Constant"> . ┊2 .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> <span class="Constant"> . ┊ .</span> ] - <span class="Comment"># sandbox title in reverse video</span> - screen-should-contain-in-color <span class="Constant">240/dark-grey</span>, [ + <span class="Comment"># sandbox menu in reverse video</span> + screen-should-contain-in-color <span class="Constant">232/black</span>, [ <span class="Constant"> . .</span> <span class="Constant"> . .</span> <span class="Constant"> . .</span> - <span class="Constant"> . 0 .</span> + <span class="Constant"> . 0 edit copy delete .</span> ] <span class="Comment"># run another command</span> assume-console [ @@ -143,11 +146,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> <span class="Constant"> . ┊add 2, 2 .</span> <span class="Constant"> . ┊4 .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊1 x.</span> + <span class="Constant"> . ┊1 edit copy delete .</span> <span class="Constant"> . ┊divide-with-remainder 11, 3 .</span> <span class="Constant"> . ┊3 .</span> <span class="Constant"> . ┊2 .</span> @@ -303,10 +306,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># render sandbox menu</span> row<span class="Special"> <- </span>add row, <span class="Constant">1</span> screen<span class="Special"> <- </span>move-cursor screen, row, left - print screen, idx, <span class="Constant">240/dark-grey</span> - clear-line-delimited screen, left, right - delete-icon:character<span class="Special"> <- </span>copy <span class="Constant">120/x</span> - print screen, delete-icon, <span class="Constant">245/grey</span> + screen<span class="Special"> <- </span>render-sandbox-menu screen, idx, left, right <span class="Comment"># save menu row so we can detect clicks to it later</span> *sandbox<span class="Special"> <- </span>put *sandbox, <span class="Constant">starting-row-on-screen:offset</span>, row <span class="Comment"># render sandbox contents</span> @@ -348,6 +348,46 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color row, screen<span class="Special"> <- </span>render-sandboxes screen, next-sandbox, left, right, row, render-from, next-idx ] +<span class="muRecipe">def</span> render-sandbox-menu screen:address:screen, sandbox-index:number, left:number, right:number<span class="muRecipe"> -> </span>screen:address:screen [ + <span class="Constant">local-scope</span> + <span class="Constant">load-ingredients</span> + move-cursor-to-column screen, left + edit-button-left:number, edit-button-right:number, copy-button-left:number, copy-button-right:number, delete-button-left:number<span class="Special"> <- </span>sandbox-menu-columns left, right + print screen, sandbox-index, <span class="Constant">232/dark-grey</span>, <span class="Constant">245/grey</span> + start-buttons:number<span class="Special"> <- </span>subtract edit-button-left, <span class="Constant">1</span> + clear-line-until screen, start-buttons, <span class="Constant">245/grey</span> + print screen, <span class="Constant">[edit]</span>, <span class="Constant">232/black</span>, <span class="Constant">94/background-orange</span> + clear-line-until screen, edit-button-right, <span class="Constant">94/background-orange</span> + _, col:number<span class="Special"> <- </span>cursor-position screen + at-start-of-copy-button?:boolean<span class="Special"> <- </span>equal col, copy-button-left + assert at-start-of-copy-button?, <span class="Constant">[aaa]</span> + print screen, <span class="Constant">[copy]</span>, <span class="Constant">232/black</span>, <span class="Constant">58/background-green</span> + clear-line-until screen, copy-button-right, <span class="Constant">58/background-green</span> + _, col:number<span class="Special"> <- </span>cursor-position screen + at-start-of-delete-button?:boolean<span class="Special"> <- </span>equal col, delete-button-left + assert at-start-of-delete-button?, <span class="Constant">[bbb]</span> + print screen, <span class="Constant">[delete]</span>, <span class="Constant">232/black</span>, <span class="Constant">52/background-red</span> + clear-line-until screen, right, <span class="Constant">52/background-red</span> +] + +<span class="Comment"># divide up the menu bar for a sandbox into 3 segments, for edit/copy/delete buttons</span> +<span class="Comment"># delete-button-right == right</span> +<span class="Comment"># all left/right pairs are inclusive</span> +<span class="muRecipe">def</span> sandbox-menu-columns left:number, right:number<span class="muRecipe"> -> </span>edit-button-left:number, edit-button-right:number, copy-button-left:number, copy-button-right:number, delete-button-left:number [ + <span class="Constant">local-scope</span> + <span class="Constant">load-ingredients</span> + start-buttons:number<span class="Special"> <- </span>add left, <span class="Constant">4/space-for-sandbox-index</span> + buttons-space:number<span class="Special"> <- </span>subtract right, start-buttons + button-width:number<span class="Special"> <- </span>divide-with-remainder buttons-space, <span class="Constant">3</span> <span class="Comment"># integer division</span> + buttons-wide-enough?:boolean<span class="Special"> <- </span>greater-or-equal button-width, <span class="Constant">8</span> + assert buttons-wide-enough?, <span class="Constant">[sandbox must be at least 30 or so characters wide]</span> + edit-button-left:number<span class="Special"> <- </span>copy start-buttons + copy-button-left:number<span class="Special"> <- </span>add start-buttons, button-width + edit-button-right:number<span class="Special"> <- </span>subtract copy-button-left, <span class="Constant">1</span> + delete-button-left:number<span class="Special"> <- </span>subtract right, button-width + copy-button-right:number<span class="Special"> <- </span>subtract delete-button-left, <span class="Constant">1</span> +] + <span class="Comment"># assumes programming environment has no sandboxes; restores them from previous session</span> <span class="muRecipe">def</span> restore-sandboxes env:address:programming-environment-data<span class="muRecipe"> -> </span>env:address:programming-environment-data [ <span class="Constant">local-scope</span> @@ -360,26 +400,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color filename:address:array:character<span class="Special"> <- </span>to-text idx contents:address:array:character<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>put *curr, <span class="Constant">data:offset</span>, contents - <span class="Comment"># restore expected output for sandbox if it exists</span> +<span class="Constant"> <end-restore-sandbox></span> <span class="Delimiter">{</span> - filename<span class="Special"> <- </span>append filename, <span class="Constant">[.out]</span> - contents<span class="Special"> <- </span>restore filename - <span class="muControl">break-unless</span> contents -<span class="Constant"> <end-restore-sandbox></span> + <span class="muControl">break-if</span> idx + *env<span class="Special"> <- </span>put *env, <span class="Constant">sandbox:offset</span>, curr <span class="Delimiter">}</span> -<span class="Constant"> +continue</span> - idx<span class="Special"> <- </span>add idx, <span class="Constant">1</span> <span class="Delimiter">{</span> - <span class="muControl">break-unless</span> prev + <span class="muControl">break-unless</span> idx *prev<span class="Special"> <- </span>put *prev, <span class="Constant">next-sandbox:offset</span>, curr <span class="Delimiter">}</span> + idx<span class="Special"> <- </span>add idx, <span class="Constant">1</span> prev<span class="Special"> <- </span>copy curr <span class="muControl">loop</span> <span class="Delimiter">}</span> - *env<span class="Special"> <- </span>put *env, <span class="Constant">sandbox:offset</span>, curr <span class="Comment"># update sandbox count</span> *env<span class="Special"> <- </span>put *env, <span class="Constant">number-of-sandboxes:offset</span>, idx ] @@ -473,7 +510,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> .local-scope ┊0 x.</span> + <span class="Constant"> .local-scope ┊0 edit copy delete .</span> <span class="Constant"> .z:number <- add 2, 2 ┊foo .</span> <span class="Constant"> .reply z ┊4 .</span> <span class="Constant"> .] ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> @@ -495,7 +532,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> .local-scope ┊0 x.</span> + <span class="Constant"> .local-scope ┊0 edit copy delete .</span> <span class="Constant"> .z:number <- add 2, 3 ┊foo .</span> <span class="Constant"> .reply z ┊5 .</span> <span class="Constant"> .] ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> @@ -524,7 +561,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> <span class="Constant"> . ┊print-integer screen, 4 .</span> <span class="Constant"> . ┊screen: .</span> <span class="Constant"> . ┊ .4 . .</span> @@ -578,7 +615,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> scrolling-down-past-bottom-of-sandbox-editor [ trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">30/width</span>, <span class="Constant">10/height</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize sandbox side</span> <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[add 2, 2]</span> @@ -587,27 +624,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ <span class="Comment"># create a sandbox</span> press F4 - <span class="Comment"># switch to sandbox editor and type in 2 lines</span> - press ctrl-n - type <span class="Constant">[abc</span> -<span class="Constant">]</span> - ] - run [ - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data - <span class="Constant">4</span>:character/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:address:screen, <span class="Constant">4</span>:character/cursor ] + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data screen-should-contain [ - <span class="Constant"> . . # minor: F4 clears menu tooltip in very narrow screens</span> - <span class="Constant"> . ┊abc .</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊␣ .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - ] - <span class="Comment"># hit 'down' at bottom of sandbox editor</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + ] + <span class="Comment"># switch to sandbox window and hit 'page-down'</span> assume-console [ - press down-arrow + press ctrl-n + press page-down ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data @@ -617,44 +646,37 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊␣ x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> - ] - <span class="Comment"># hit 'up'</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊␣ edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + ] + <span class="Comment"># hit 'page-up'</span> assume-console [ - press up-arrow + press page-up ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data <span class="Constant">4</span>:character/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> print screen:address:screen, <span class="Constant">4</span>:character/cursor ] - <span class="Comment"># sandbox editor displays again</span> + <span class="Comment"># sandbox editor displays again, cursor is in editor</span> screen-should-contain [ - <span class="Constant"> . . # minor: F4 clears menu tooltip in very narrow screens</span> - <span class="Constant"> . ┊abc .</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊␣ .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊␣ .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> ] ] -<span class="Comment"># down on sandbox side updates render-from when sandbox editor has cursor at bottom</span> +<span class="Comment"># page-down on sandbox side updates render-from to scroll sandboxes</span> <span class="muRecipe">after</span> <span class="Constant"><global-keypress></span> [ <span class="Delimiter">{</span> <span class="muControl">break-unless</span> sandbox-in-focus? - down?:boolean<span class="Special"> <- </span>equal k, <span class="Constant">65516/down-arrow</span> - <span class="muControl">break-unless</span> down? - sandbox-bottom:number<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">bottom:offset</span> - sandbox-cursor:number<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">cursor-row:offset</span> - sandbox-cursor-on-last-line?:boolean<span class="Special"> <- </span>equal sandbox-bottom, sandbox-cursor - <span class="muControl">break-unless</span> sandbox-cursor-on-last-line? + page-down?:boolean<span class="Special"> <- </span>equal k, <span class="Constant">65518/page-down</span> + <span class="muControl">break-unless</span> page-down? sandbox:address:sandbox-data<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> @@ -687,12 +709,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="Comment"># 'up' on sandbox side is like 'down': updates render-from when necessary</span> +<span class="Comment"># 'page-up' on sandbox side is like 'page-down': updates render-from when necessary</span> <span class="muRecipe">after</span> <span class="Constant"><global-keypress></span> [ <span class="Delimiter">{</span> <span class="muControl">break-unless</span> sandbox-in-focus? - up?:boolean<span class="Special"> <- </span>equal k, <span class="Constant">65517/up-arrow</span> - <span class="muControl">break-unless</span> up? + page-up?:boolean<span class="Special"> <- </span>equal k, <span class="Constant">65519/page-up</span> + <span class="muControl">break-unless</span> page-up? render-from:number<span class="Special"> <- </span>get *env, <span class="Constant">render-from:offset</span> at-beginning?:boolean<span class="Special"> <- </span>equal render-from, <span class="Constant">-1</span> <span class="muControl">break-if</span> at-beginning? @@ -726,7 +748,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> scrolling-down-on-recipe-side [ trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">30/width</span>, <span class="Constant">10/height</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize sandbox side and create a sandbox</span> <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">]</span> @@ -749,20 +771,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor moves down on recipe side</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> .␣ ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> .␣ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> ] ] <span class="muScenario">scenario</span> scrolling-through-multiple-sandboxes [ trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">30/width</span>, <span class="Constant">10/height</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> @@ -780,20 +799,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">4</span>:character/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> print screen:address:screen, <span class="Constant">4</span>:character/cursor screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊␣ .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊1 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - ] - <span class="Comment"># hit 'down'</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊␣ .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + ] + <span class="Comment"># hit 'page-down'</span> assume-console [ - press down-arrow + press page-down ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data @@ -803,76 +822,72 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊␣ x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊1 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - ] - <span class="Comment"># hit 'down' again</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊␣ edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + ] + <span class="Comment"># hit 'page-down' again</span> assume-console [ - press down-arrow + press page-down ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data ] <span class="Comment"># just second sandbox displayed</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> . ┊ .</span> - ] - <span class="Comment"># hit 'down' again</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># hit 'page-down' again</span> assume-console [ - press down-arrow + press page-down ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data ] <span class="Comment"># no change</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> . ┊ .</span> - ] - <span class="Comment"># hit 'up'</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># hit 'page-up'</span> assume-console [ - press up-arrow + press page-up ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data ] <span class="Comment"># back to displaying both sandboxes without editor</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊1 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - ] - <span class="Comment"># hit 'up' again</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + ] + <span class="Comment"># hit 'page-up' again</span> assume-console [ - press up-arrow + press page-up ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data @@ -881,42 +896,44 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># back to displaying both sandboxes as well as editor</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊␣ .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊1 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - ] - <span class="Comment"># hit 'up' again</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊␣ .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + ] + <span class="Comment"># hit 'page-up' again</span> assume-console [ - press up-arrow + press page-up ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + <span class="Constant">4</span>:character/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:address:screen, <span class="Constant">4</span>:character/cursor ] <span class="Comment"># no change</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊␣ .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊1 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊␣ .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> ] ] <span class="muScenario">scenario</span> scrolling-manages-sandbox-index-correctly [ trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">30/width</span>, <span class="Constant">10/height</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> @@ -930,18 +947,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊ .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> - ] - <span class="Comment"># hit 'down' and 'up' a couple of times. sandbox index should be stable</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># hit 'page-down' and 'page-up' a couple of times. sandbox index should be stable</span> assume-console [ - press down-arrow + press page-down ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data @@ -949,35 +966,35 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> - ] - <span class="Comment"># hit 'up' again</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># hit 'page-up' again</span> assume-console [ - press up-arrow + press page-up ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data ] <span class="Comment"># back to displaying both sandboxes as well as editor</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊ .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> - ] - <span class="Comment"># hit 'down'</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># hit 'page-down'</span> assume-console [ - press down-arrow + press page-down ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data @@ -985,13 +1002,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># sandbox editor hidden; first sandbox displayed</span> <span class="Comment"># cursor moves to first sandbox</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 x. # no change</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] ] </pre> diff --git a/html/edit/006-sandbox-copy.mu.html b/html/edit/006-sandbox-copy.mu.html new file mode 100644 index 00000000..c201b609 --- /dev/null +++ b/html/edit/006-sandbox-copy.mu.html @@ -0,0 +1,322 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<title>Mu - edit/006-sandbox-copy.mu</title> +<meta name="Generator" content="Vim/7.4"> +<meta name="plugin-version" content="vim7.4_v2"> +<meta name="syntax" content="none"> +<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy="> +<meta name="colorscheme" content="minimal"> +<style type="text/css"> +<!-- +pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } +body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } +* { font-size: 12pt; font-size: 1em; } +.muScenario { color: #00af00; } +.Special { color: #c00000; } +.Delimiter { color: #800080; } +.muRecipe { color: #ff8700; } +.Comment { color: #9090ff; } +.Constant { color: #00a0a0; } +.SalientComment { color: #00ffff; } +.muControl { color: #c0a020; } +--> +</style> + +<script type='text/javascript'> +<!-- + +--> +</script> +</head> +<body> +<pre id='vimCodeElement'> +<span class="SalientComment">## the 'copy' button makes it easy to duplicate a sandbox, and thence to</span> +<span class="SalientComment">## see code operate in multiple situations</span> + +<span class="muScenario">scenario</span> copy-a-sandbox-to-editor [ + trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> + <span class="Comment"># basic recipe</span> + <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> +<span class="Constant">recipe foo [</span> +<span class="Constant"> reply 4</span> +<span class="Constant">]</span>] + <span class="Comment"># run it</span> + <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[foo]</span> + assume-console [ + press F4 + ] + <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># click at left edge of 'copy' button</span> + assume-console [ + left-click <span class="Constant">3</span>, <span class="Constant">69</span> + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + <span class="Comment"># it copies into editor</span> + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊foo .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># cursor should be in the right place</span> + assume-console [ + type <span class="Constant">[0]</span> + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊0foo .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] +] + +<span class="muScenario">scenario</span> copy-a-sandbox-to-editor-2 [ + trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> + <span class="Comment"># basic recipe</span> + <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> +<span class="Constant">recipe foo [</span> +<span class="Constant"> reply 4</span> +<span class="Constant">]</span>] + <span class="Comment"># run it</span> + <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[foo]</span> + assume-console [ + press F4 + ] + <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># click at right edge of 'copy' button (just before 'delete')</span> + assume-console [ + left-click <span class="Constant">3</span>, <span class="Constant">84</span> + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + <span class="Comment"># it copies into editor</span> + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊foo .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># cursor should be in the right place</span> + assume-console [ + type <span class="Constant">[0]</span> + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊0foo .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] +] + +<span class="muRecipe">after</span> <span class="Constant"><global-touch></span> [ + <span class="Comment"># support 'copy' button</span> + <span class="Delimiter">{</span> + copy?:boolean<span class="Special"> <- </span>should-attempt-copy? click-row, click-column, env + <span class="muControl">break-unless</span> copy? + copy?, env<span class="Special"> <- </span>try-copy-sandbox click-row, env + <span class="muControl">break-unless</span> copy? + hide-screen screen + screen<span class="Special"> <- </span>render-sandbox-side screen, env + screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + show-screen screen + <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="Delimiter">}</span> +] + +<span class="Comment"># some preconditions for attempting to copy a sandbox</span> +<span class="muRecipe">def</span> should-attempt-copy? click-row:number, click-column:number, env:address:programming-environment-data<span class="muRecipe"> -> </span>result:boolean [ + <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?:boolean<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:address:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + assert first-sandbox, <span class="Constant">[!!]</span> + sandbox-left-margin:number<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">left:offset</span> + sandbox-right-margin:number<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">right:offset</span> + _, _, copy-button-left:number, copy-button-right:number, _<span class="Special"> <- </span>sandbox-menu-columns sandbox-left-margin, sandbox-right-margin + copy-button-vertical-area?:boolean<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:address:editor-data<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:number, env:address:programming-environment-data<span class="muRecipe"> -> </span>clicked-on-copy-button?:boolean, env:address:programming-environment-data [ + <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:address:sandbox-data<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:address:array:character<span class="Special"> <- </span>get *sandbox, <span class="Constant">data:offset</span> + current-sandbox:address:editor-data<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> + <span class="Comment"># position cursor in sandbox editor</span> + *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:address:programming-environment-data, click-row:number<span class="muRecipe"> -> </span>result:address:sandbox-data [ + <span class="Constant">local-scope</span> + <span class="Constant">load-ingredients</span> + curr-sandbox:address:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + <span class="Delimiter">{</span> + start:number<span class="Special"> <- </span>get *curr-sandbox, <span class="Constant">starting-row-on-screen:offset</span> + found?:boolean<span class="Special"> <- </span>equal click-row, start + <span class="muControl">return-if</span> found?, curr-sandbox + curr-sandbox<span class="Special"> <- </span>get *curr-sandbox, <span class="Constant">next-sandbox:offset</span> + <span class="muControl">loop</span> + <span class="Delimiter">}</span> + <span class="muControl">return</span> <span class="Constant">0/not-found</span> +] + +<span class="muRecipe">def</span> click-on-sandbox-area? click-row:number, click-column:number, env:address:programming-environment-data<span class="muRecipe"> -> </span>result:boolean [ + <span class="Constant">local-scope</span> + <span class="Constant">load-ingredients</span> + current-sandbox:address:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + sandbox-left-margin:number<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">left:offset</span> + on-sandbox-side?:boolean<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:address:sandbox-data<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:number<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:address:editor-data<span class="muRecipe"> -> </span>result:boolean [ + <span class="Constant">local-scope</span> + <span class="Constant">load-ingredients</span> + head:address:duplex-list:character<span class="Special"> <- </span>get *editor, <span class="Constant">data:offset</span> + first:address:duplex-list:character<span class="Special"> <- </span>next head + result<span class="Special"> <- </span>not first +] + +<span class="muRecipe">def</span> within-range? x:number, low:number, high:number<span class="muRecipe"> -> </span>result:boolean [ + <span class="Constant">local-scope</span> + <span class="Constant">load-ingredients</span> + not-too-far-left?:boolean<span class="Special"> <- </span>greater-or-equal x, low + not-too-far-right?:boolean<span class="Special"> <- </span>lesser-or-equal x, high + result<span class="Special"> <- </span>and not-too-far-left? not-too-far-right? +] + +<span class="muScenario">scenario</span> copy-fails-if-sandbox-editor-not-empty [ + trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> + <span class="Comment"># basic recipe</span> + <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> +<span class="Constant">recipe foo [</span> +<span class="Constant"> reply 4</span> +<span class="Constant">]</span>] + <span class="Comment"># run it</span> + <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[foo]</span> + assume-console [ + press F4 + ] + <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># type something into the sandbox editor, then click on the 'copy' button</span> + assume-console [ + left-click <span class="Constant">2</span>, <span class="Constant">70</span> <span class="Comment"># put cursor in sandbox editor</span> + type <span class="Constant">[0]</span> <span class="Comment"># type something</span> + left-click <span class="Constant">3</span>, <span class="Constant">70</span> <span class="Comment"># click 'copy' button</span> + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + <span class="Comment"># copy doesn't happen</span> + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊0 .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># cursor should be in the right place</span> + assume-console [ + type <span class="Constant">[1]</span> + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊01 .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] +] +</pre> +</body> +</html> +<!-- vim: set foldmethod=manual : --> diff --git a/html/edit/006-sandbox-edit.mu.html b/html/edit/006-sandbox-edit.mu.html deleted file mode 100644 index 85684b0e..00000000 --- a/html/edit/006-sandbox-edit.mu.html +++ /dev/null @@ -1,339 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> -<html> -<head> -<meta http-equiv="content-type" content="text/html; charset=UTF-8"> -<title>Mu - edit/006-sandbox-edit.mu</title> -<meta name="Generator" content="Vim/7.4"> -<meta name="plugin-version" content="vim7.4_v2"> -<meta name="syntax" content="none"> -<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy="> -<meta name="colorscheme" content="minimal"> -<style type="text/css"> -<!-- -pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } -* { font-size: 12pt; font-size: 1em; } -.muScenario { color: #00af00; } -.Special { color: #c00000; } -.Delimiter { color: #800080; } -.muRecipe { color: #ff8700; } -.Comment { color: #9090ff; } -.Constant { color: #00a0a0; } -.SalientComment { color: #00ffff; } -.muControl { color: #c0a020; } ---> -</style> - -<script type='text/javascript'> -<!-- - ---> -</script> -</head> -<body> -<pre id='vimCodeElement'> -<span class="SalientComment">## editing sandboxes after they've been created</span> - -<span class="muScenario">scenario</span> clicking-on-a-sandbox-moves-it-to-editor [ - trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">40/width</span>, <span class="Constant">10/height</span> - <span class="Comment"># basic recipe</span> - <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> -<span class="Constant">recipe foo [</span> -<span class="Constant"> reply 4</span> -<span class="Constant">]</span>] - <span class="Comment"># run it</span> - <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[foo]</span> - assume-console [ - press F4 - ] - <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data - screen-should-contain [ - <span class="Constant"> . run (F4) .</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . reply 4 ┊0 x.</span> - <span class="Constant"> .] ┊foo .</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> - ] - <span class="Comment"># click somewhere in the first row of the sandbox</span> - assume-console [ - left-click <span class="Constant">3</span>, <span class="Constant">30</span> - ] - run [ - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data - ] - <span class="Comment"># it pops back into editor</span> - screen-should-contain [ - <span class="Constant"> . run (F4) .</span> - <span class="Constant"> . ┊foo .</span> - <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . reply 4 ┊ .</span> - <span class="Constant"> .] ┊ .</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ .</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> . ┊ .</span> - ] - <span class="Comment"># cursor should be in the right place</span> - assume-console [ - type <span class="Constant">[0]</span> - ] - run [ - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data - ] - screen-should-contain [ - <span class="Constant"> . run (F4) .</span> - <span class="Constant"> . ┊0foo .</span> - <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . reply 4 ┊ .</span> - <span class="Constant"> .] ┊ .</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ .</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> . ┊ .</span> - ] -] - -<span class="muRecipe">after</span> <span class="Constant"><global-touch></span> [ - <span class="Comment"># below sandbox editor? pop appropriate sandbox contents back into sandbox editor</span> - <span class="Delimiter">{</span> - sandbox-left-margin:number<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">left:offset</span> - click-column:number<span class="Special"> <- </span>get t, <span class="Constant">column:offset</span> - on-sandbox-side?:boolean<span class="Special"> <- </span>greater-or-equal click-column, sandbox-left-margin - <span class="muControl">break-unless</span> on-sandbox-side? - first-sandbox:address:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> - <span class="muControl">break-unless</span> first-sandbox - first-sandbox-begins:number<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">starting-row-on-screen:offset</span> - click-row:number<span class="Special"> <- </span>get t, <span class="Constant">row:offset</span> - below-sandbox-editor?:boolean<span class="Special"> <- </span>greater-or-equal click-row, first-sandbox-begins - <span class="muControl">break-unless</span> below-sandbox-editor? - empty-sandbox-editor?:boolean<span class="Special"> <- </span>empty-editor? current-sandbox - <span class="muControl">break-unless</span> empty-sandbox-editor? <span class="Comment"># don't clobber existing contents</span> - <span class="Comment"># identify the sandbox to edit and remove it from the sandbox list</span> - sandbox:address:sandbox-data<span class="Special"> <- </span>extract-sandbox env, click-row - <span class="muControl">break-unless</span> sandbox - text:address:array:character<span class="Special"> <- </span>get *sandbox, <span class="Constant">data:offset</span> - current-sandbox<span class="Special"> <- </span>insert-text current-sandbox, text - *env<span class="Special"> <- </span>put *env, <span class="Constant">render-from:offset</span>, <span class="Constant">-1</span> - hide-screen screen - screen<span class="Special"> <- </span>render-sandbox-side screen, env - screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env - show-screen screen - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> - <span class="Delimiter">}</span> -] - -<span class="muRecipe">def</span> empty-editor? editor:address:editor-data<span class="muRecipe"> -> </span>result:boolean [ - <span class="Constant">local-scope</span> - <span class="Constant">load-ingredients</span> - head:address:duplex-list:character<span class="Special"> <- </span>get *editor, <span class="Constant">data:offset</span> - first:address:duplex-list:character<span class="Special"> <- </span>next head - result<span class="Special"> <- </span>not first -] - -<span class="muRecipe">def</span> extract-sandbox env:address:programming-environment-data, click-row:number<span class="muRecipe"> -> </span>result:address:sandbox-data, env:address:programming-environment-data [ - <span class="Constant">local-scope</span> - <span class="Constant">load-ingredients</span> - curr-sandbox:address:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> - start:number<span class="Special"> <- </span>get *curr-sandbox, <span class="Constant">starting-row-on-screen:offset</span> - in-editor?:boolean<span class="Special"> <- </span>lesser-than click-row, start - <span class="muControl">return-if</span> in-editor?, <span class="Constant">0</span> - first-sandbox?:boolean<span class="Special"> <- </span>equal click-row, start - <span class="Delimiter">{</span> - <span class="Comment"># first sandbox? pop</span> - <span class="muControl">break-unless</span> first-sandbox? - next-sandbox:address:sandbox-data<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:address:sandbox-data<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> - next-sandbox:address:sandbox-data<span class="Special"> <- </span>get *curr-sandbox, <span class="Constant">next-sandbox:offset</span> - <span class="muControl">break-unless</span> next-sandbox - <span class="Comment"># if click-row < sandbox.next-sandbox.starting-row-on-screen, break</span> - next-start:number<span class="Special"> <- </span>get *next-sandbox, <span class="Constant">starting-row-on-screen:offset</span> - found?:boolean<span class="Special"> <- </span>lesser-than click-row, next-start - <span class="muControl">break-if</span> found? - prev-sandbox<span class="Special"> <- </span>copy curr-sandbox - curr-sandbox<span class="Special"> <- </span>copy next-sandbox - <span class="muControl">loop</span> - <span class="Delimiter">}</span> - <span class="Comment"># snip sandbox out of its list</span> - *prev-sandbox<span class="Special"> <- </span>put *prev-sandbox, <span class="Constant">next-sandbox:offset</span>, next-sandbox - <span class="Delimiter">}</span> - result<span class="Special"> <- </span>copy curr-sandbox - <span class="Comment"># update sandbox count</span> - sandbox-count:number<span class="Special"> <- </span>get *env, <span class="Constant">number-of-sandboxes:offset</span> - sandbox-count<span class="Special"> <- </span>subtract sandbox-count, <span class="Constant">1</span> - *env<span class="Special"> <- </span>put *env, <span class="Constant">number-of-sandboxes:offset</span>, sandbox-count - <span class="Comment"># position cursor in sandbox editor</span> - *env<span class="Special"> <- </span>put *env, <span class="Constant">sandbox-in-focus?:offset</span>, <span class="Constant">1/true</span> -] - -<span class="muScenario">scenario</span> sandbox-with-print-can-be-edited [ - trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">100/width</span>, <span class="Constant">20/height</span> - <span class="Comment"># left editor is empty</span> - <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Comment"># right editor contains an instruction</span> - <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[print-integer screen, 4]</span> - <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character - <span class="Comment"># run the sandbox</span> - assume-console [ - press F4 - ] - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data - screen-should-contain [ - <span class="Constant"> . run (F4) .</span> - <span class="Constant"> . ┊ .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊print-integer screen, 4 .</span> - <span class="Constant"> . ┊screen: .</span> - <span class="Constant"> . ┊ .4 . .</span> - <span class="Constant"> . ┊ . . .</span> - <span class="Constant"> . ┊ . . .</span> - <span class="Constant"> . ┊ . . .</span> - <span class="Constant"> . ┊ . . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> - ] - <span class="Comment"># edit the sandbox</span> - assume-console [ - left-click <span class="Constant">3</span>, <span class="Constant">70</span> - ] - run [ - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data - ] - screen-should-contain [ - <span class="Constant"> . run (F4) .</span> - <span class="Constant"> . ┊print-integer screen, 4 .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> . ┊ .</span> - ] -] - -<span class="muScenario">scenario</span> editing-sandbox-after-scrolling-resets-scroll [ - trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">30/width</span>, <span class="Constant">10/height</span> - <span class="Comment"># initialize environment</span> - <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character - render-all screen, <span class="Constant">3</span>:address:programming-environment-data - <span class="Comment"># create 2 sandboxes and scroll to second</span> - assume-console [ - press ctrl-n - type <span class="Constant">[add 2, 2]</span> - press F4 - type <span class="Constant">[add 1, 1]</span> - press F4 - press down-arrow - press down-arrow - ] - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data - screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> - ] - <span class="Comment"># edit the second sandbox</span> - assume-console [ - left-click <span class="Constant">2</span>, <span class="Constant">20</span> - ] - run [ - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data - ] - <span class="Comment"># second sandbox shows in editor; scroll resets to display first sandbox</span> - screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊add 2, 2 .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> - ] -] - -<span class="muScenario">scenario</span> editing-sandbox-updates-sandbox-count [ - trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">30/width</span>, <span class="Constant">10/height</span> - <span class="Comment"># initialize environment</span> - <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character - render-all screen, <span class="Constant">3</span>:address:programming-environment-data - <span class="Comment"># create 2 sandboxes</span> - assume-console [ - press ctrl-n - type <span class="Constant">[add 2, 2]</span> - press F4 - type <span class="Constant">[add 1, 1]</span> - press F4 - ] - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data - screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊ .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊1 x.</span> - ] - <span class="Comment"># edit the second sandbox, then resave</span> - assume-console [ - left-click <span class="Constant">3</span>, <span class="Constant">20</span> - press F4 - ] - run [ - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data - ] - <span class="Comment"># no change in contents</span> - screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊ .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊1 x.</span> - ] - <span class="Comment"># now try to scroll past end</span> - assume-console [ - press down-arrow - press down-arrow - press down-arrow - ] - run [ - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data - ] - <span class="Comment"># screen should show just final sandbox</span> - screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> - ] -] -</pre> -</body> -</html> -<!-- vim: set foldmethod=manual : --> diff --git a/html/edit/007-sandbox-delete.mu.html b/html/edit/007-sandbox-delete.mu.html index b29c649d..137a7887 100644 --- a/html/edit/007-sandbox-delete.mu.html +++ b/html/edit/007-sandbox-delete.mu.html @@ -53,20 +53,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> <span class="Constant"> . ┊add 2, 2 .</span> <span class="Constant"> . ┊4 .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊1 x.</span> + <span class="Constant"> . ┊1 edit copy delete .</span> <span class="Constant"> . ┊divide-with-remainder 11, 3 .</span> <span class="Constant"> . ┊3 .</span> <span class="Constant"> . ┊2 .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> <span class="Constant"> . ┊ .</span> ] - <span class="Comment"># delete second sandbox</span> + <span class="Comment"># delete second sandbox by clicking on left edge of 'delete' button</span> assume-console [ - left-click <span class="Constant">7</span>, <span class="Constant">99</span> + left-click <span class="Constant">7</span>, <span class="Constant">85</span> ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data @@ -75,14 +75,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> <span class="Constant"> . ┊add 2, 2 .</span> <span class="Constant"> . ┊4 .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> . ┊ .</span> ] - <span class="Comment"># delete first sandbox</span> + <span class="Comment"># delete first sandbox by clicking at right edge of 'delete' button</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">99</span> ] @@ -99,10 +99,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muRecipe">after</span> <span class="Constant"><global-touch></span> [ - <span class="Comment"># on a sandbox delete icon? process delete</span> + <span class="Comment"># support 'delete' button</span> <span class="Delimiter">{</span> - was-delete?:boolean<span class="Special"> <- </span>delete-sandbox t, env - <span class="muControl">break-unless</span> was-delete? + delete?:boolean<span class="Special"> <- </span>should-attempt-delete? click-row, click-column, env + <span class="muControl">break-unless</span> delete? + delete?, env<span class="Special"> <- </span>try-delete-sandbox click-row, env + <span class="muControl">break-unless</span> delete? hide-screen screen screen<span class="Special"> <- </span>render-sandbox-side screen, env screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env @@ -111,70 +113,77 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> delete-sandbox t:touch-event, env:address:programming-environment-data<span class="muRecipe"> -> </span>was-delete?:boolean, env:address:programming-environment-data [ +<span class="Comment"># some preconditions for attempting to delete a sandbox</span> +<span class="muRecipe">def</span> should-attempt-delete? click-row:number, click-column:number, env:address:programming-environment-data<span class="muRecipe"> -> </span>result:boolean [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - click-column:number<span class="Special"> <- </span>get t, <span class="Constant">column:offset</span> - current-sandbox:address:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> - right:number<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">right:offset</span> - at-right?:boolean<span class="Special"> <- </span>equal click-column, right - <span class="muControl">return-unless</span> at-right?, <span class="Constant">0/false</span> - click-row:number<span class="Special"> <- </span>get t, <span class="Constant">row:offset</span> + <span class="Comment"># are we below the sandbox editor?</span> + click-sandbox-area?:boolean<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:address:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + assert first-sandbox, <span class="Constant">[!!]</span> + sandbox-left-margin:number<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">left:offset</span> + sandbox-right-margin:number<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">right:offset</span> + _, _, _, _, delete-button-left:number<span class="Special"> <- </span>sandbox-menu-columns sandbox-left-margin, sandbox-right-margin + 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:number, env:address:programming-environment-data<span class="muRecipe"> -> </span>clicked-on-delete-button?:boolean, env:address:programming-environment-data [ + <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:address:sandbox-data<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:address:programming-environment-data, sandbox:address:sandbox-data<span class="muRecipe"> -> </span>env:address:programming-environment-data [ + <span class="Constant">local-scope</span> + <span class="Constant">load-ingredients</span> + curr-sandbox:address:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + first-sandbox?:boolean<span class="Special"> <- </span>equal curr-sandbox, sandbox <span class="Delimiter">{</span> - first:address:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> - <span class="muControl">reply-unless</span> first, <span class="Constant">0/false</span> - target-row:number<span class="Special"> <- </span>get *first, <span class="Constant">starting-row-on-screen:offset</span> - delete-first?:boolean<span class="Special"> <- </span>equal target-row, click-row - <span class="muControl">break-unless</span> delete-first? - new-first:address:sandbox-data<span class="Special"> <- </span>get *first, <span class="Constant">next-sandbox:offset</span> - *env<span class="Special"> <- </span>put *env, <span class="Constant">sandbox:offset</span>, new-first - env<span class="Special"> <- </span>fixup-delete env, new-first - <span class="muControl">return</span> <span class="Constant">1/true</span> <span class="Comment"># force rerender</span> + <span class="Comment"># first sandbox? pop</span> + <span class="muControl">break-unless</span> first-sandbox? + next-sandbox:address:sandbox-data<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> - prev:address:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> - assert prev, <span class="Constant">[failed to find any sandboxes!]</span> - curr:address:sandbox-data<span class="Special"> <- </span>get *prev, <span class="Constant">next-sandbox:offset</span> <span class="Delimiter">{</span> - <span class="muControl">break-unless</span> curr - <span class="Comment"># more sandboxes to check</span> + <span class="Comment"># not first sandbox?</span> + <span class="muControl">break-if</span> first-sandbox? + prev-sandbox:address:sandbox-data<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> - target-row:number<span class="Special"> <- </span>get *curr, <span class="Constant">starting-row-on-screen:offset</span> - delete-curr?:boolean<span class="Special"> <- </span>equal target-row, click-row - <span class="muControl">break-unless</span> delete-curr? - <span class="Comment"># delete this sandbox</span> - next:address:sandbox-data<span class="Special"> <- </span>get *curr, <span class="Constant">next-sandbox:offset</span> - *prev<span class="Special"> <- </span>put *prev, <span class="Constant">next-sandbox:offset</span>, next - env<span class="Special"> <- </span>fixup-delete env, next - <span class="muControl">return</span> <span class="Constant">1/true</span> <span class="Comment"># force rerender</span> + assert curr-sandbox, <span class="Constant">[sandbox not found! something is wrong.]</span> + found?:boolean<span class="Special"> <- </span>equal curr-sandbox, sandbox + <span class="muControl">break-if</span> found? + prev-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="muControl">loop</span> <span class="Delimiter">}</span> - prev<span class="Special"> <- </span>copy curr - curr<span class="Special"> <- </span>get *curr, <span class="Constant">next-sandbox:offset</span> - <span class="muControl">loop</span> + <span class="Comment"># snip sandbox out of its list</span> + next-sandbox:address:sandbox-data<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="muControl">return</span> <span class="Constant">0/false</span> -] - -<span class="muRecipe">def</span> fixup-delete env:address:programming-environment-data, next:address:sandbox-data<span class="muRecipe"> -> </span>env:address:programming-environment-data [ - <span class="Constant">local-scope</span> - <span class="Constant">load-ingredients</span> <span class="Comment"># update sandbox count</span> sandbox-count:number<span class="Special"> <- </span>get *env, <span class="Constant">number-of-sandboxes:offset</span> sandbox-count<span class="Special"> <- </span>subtract sandbox-count, <span class="Constant">1</span> *env<span class="Special"> <- </span>put *env, <span class="Constant">number-of-sandboxes:offset</span>, sandbox-count + <span class="Comment"># reset scroll if deleted sandbox was last</span> <span class="Delimiter">{</span> - <span class="muControl">break-if</span> next - <span class="Comment"># deleted sandbox was last</span> + <span class="muControl">break-if</span> next-sandbox render-from:number<span class="Special"> <- </span>get *env, <span class="Constant">render-from:offset</span> reset-scroll?:boolean<span class="Special"> <- </span>equal render-from, sandbox-count <span class="muControl">break-unless</span> reset-scroll? - <span class="Comment"># deleted sandbox was only sandbox rendered, so reset scroll</span> *env<span class="Special"> <- </span>put *env, <span class="Constant">render-from:offset</span>, <span class="Constant">-1</span> <span class="Delimiter">}</span> ] <span class="muScenario">scenario</span> deleting-sandbox-after-scroll [ trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">30/width</span>, <span class="Constant">10/height</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> @@ -187,40 +196,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press F4 type <span class="Constant">[add 1, 1]</span> press F4 - press down-arrow + press page-down ] event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊1 x.</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊1 edit copy delete .</span> ] <span class="Comment"># delete the second sandbox</span> assume-console [ - left-click <span class="Constant">6</span>, <span class="Constant">29</span> + left-click <span class="Constant">6</span>, <span class="Constant">99</span> ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data ] <span class="Comment"># second sandbox shows in editor; scroll resets to display first sandbox</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] ] <span class="muScenario">scenario</span> deleting-top-sandbox-after-scroll [ trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">30/width</span>, <span class="Constant">10/height</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> @@ -233,40 +242,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press F4 type <span class="Constant">[add 1, 1]</span> press F4 - press down-arrow + press page-down ] event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊1 x.</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊1 edit copy delete .</span> ] <span class="Comment"># delete the second sandbox</span> assume-console [ - left-click <span class="Constant">2</span>, <span class="Constant">29</span> + left-click <span class="Constant">2</span>, <span class="Constant">99</span> ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data ] <span class="Comment"># second sandbox shows in editor; scroll resets to display first sandbox</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] ] <span class="muScenario">scenario</span> deleting-final-sandbox-after-scroll [ trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">30/width</span>, <span class="Constant">10/height</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> @@ -279,42 +288,42 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press F4 type <span class="Constant">[add 1, 1]</span> press F4 - press down-arrow - press down-arrow + press page-down + press page-down ] event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] <span class="Comment"># delete the second sandbox</span> assume-console [ - left-click <span class="Constant">2</span>, <span class="Constant">29</span> + left-click <span class="Constant">2</span>, <span class="Constant">99</span> ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data ] <span class="Comment"># implicitly scroll up to first sandbox</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊ .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] ] <span class="muScenario">scenario</span> deleting-updates-sandbox-count [ trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">30/width</span>, <span class="Constant">10/height</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># initialize environment</span> <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> @@ -330,35 +339,35 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊ .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> - <span class="Constant"> . ┊add 1, 1 .</span> - <span class="Constant"> . ┊2 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊1 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> ] <span class="Comment"># delete the second sandbox, then try to scroll down twice</span> assume-console [ - left-click <span class="Constant">3</span>, <span class="Constant">29</span> - press down-arrow - press down-arrow + left-click <span class="Constant">3</span>, <span class="Constant">99</span> + press page-down + press page-down ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data ] <span class="Comment"># shouldn't go past last sandbox</span> screen-should-contain [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 x.</span> - <span class="Constant"> . ┊add 2, 2 .</span> - <span class="Constant"> . ┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] ] </pre> diff --git a/html/edit/008-sandbox-edit.mu.html b/html/edit/008-sandbox-edit.mu.html new file mode 100644 index 00000000..80712819 --- /dev/null +++ b/html/edit/008-sandbox-edit.mu.html @@ -0,0 +1,375 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<title>Mu - edit/008-sandbox-edit.mu</title> +<meta name="Generator" content="Vim/7.4"> +<meta name="plugin-version" content="vim7.4_v2"> +<meta name="syntax" content="none"> +<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy="> +<meta name="colorscheme" content="minimal"> +<style type="text/css"> +<!-- +pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } +body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } +* { font-size: 12pt; font-size: 1em; } +.muScenario { color: #00af00; } +.Special { color: #c00000; } +.Delimiter { color: #800080; } +.muRecipe { color: #ff8700; } +.Comment { color: #9090ff; } +.Constant { color: #00a0a0; } +.SalientComment { color: #00ffff; } +.muControl { color: #c0a020; } +--> +</style> + +<script type='text/javascript'> +<!-- + +--> +</script> +</head> +<body> +<pre id='vimCodeElement'> +<span class="SalientComment">## editing sandboxes after they've been created</span> + +<span class="muScenario">scenario</span> clicking-on-a-sandbox-moves-it-to-editor [ + trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> + <span class="Comment"># basic recipe</span> + <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> +<span class="Constant">recipe foo [</span> +<span class="Constant"> reply 4</span> +<span class="Constant">]</span>] + <span class="Comment"># run it</span> + <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[foo]</span> + assume-console [ + press F4 + ] + <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># click at left edge of 'edit' button</span> + assume-console [ + left-click <span class="Constant">3</span>, <span class="Constant">55</span> + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + <span class="Comment"># it pops back into editor</span> + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊foo .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊ .</span> + <span class="Constant"> .] ┊ .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ .</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># cursor should be in the right place</span> + assume-console [ + type <span class="Constant">[0]</span> + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊0foo .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊ .</span> + <span class="Constant"> .] ┊ .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ .</span> + <span class="Constant"> . ┊ .</span> + ] +] + +<span class="muScenario">scenario</span> clicking-on-a-sandbox-moves-it-to-editor-2 [ + trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> + <span class="Comment"># basic recipe</span> + <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> +<span class="Constant">recipe foo [</span> +<span class="Constant"> reply 4</span> +<span class="Constant">]</span>] + <span class="Comment"># run it</span> + <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[foo]</span> + assume-console [ + press F4 + ] + <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># click at right edge of 'edit' button (just before 'copy')</span> + assume-console [ + left-click <span class="Constant">3</span>, <span class="Constant">68</span> + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + <span class="Comment"># it pops back into editor</span> + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊foo .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊ .</span> + <span class="Constant"> .] ┊ .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ .</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># cursor should be in the right place</span> + assume-console [ + type <span class="Constant">[0]</span> + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊0foo .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊ .</span> + <span class="Constant"> .] ┊ .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ .</span> + <span class="Constant"> . ┊ .</span> + ] +] + +<span class="muRecipe">after</span> <span class="Constant"><global-touch></span> [ + <span class="Comment"># support 'edit' button</span> + <span class="Delimiter">{</span> + edit?:boolean<span class="Special"> <- </span>should-attempt-edit? click-row, click-column, env + <span class="muControl">break-unless</span> edit? + edit?, env<span class="Special"> <- </span>try-edit-sandbox click-row, env + <span class="muControl">break-unless</span> edit? + hide-screen screen + screen<span class="Special"> <- </span>render-sandbox-side screen, env + screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + show-screen screen + <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="Delimiter">}</span> +] + +<span class="Comment"># some preconditions for attempting to edit a sandbox</span> +<span class="muRecipe">def</span> should-attempt-edit? click-row:number, click-column:number, env:address:programming-environment-data<span class="muRecipe"> -> </span>result:boolean [ + <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?:boolean<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:address:editor-data<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + assert first-sandbox, <span class="Constant">[!!]</span> + sandbox-left-margin:number<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">left:offset</span> + sandbox-right-margin:number<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">right:offset</span> + edit-button-left:number, edit-button-right:number, _<span class="Special"> <- </span>sandbox-menu-columns sandbox-left-margin, sandbox-right-margin + edit-button-vertical-area?:boolean<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:address:editor-data<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:number, env:address:programming-environment-data<span class="muRecipe"> -> </span>clicked-on-edit-button?:boolean, env:address:programming-environment-data [ + <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:address:sandbox-data<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:address:array:character<span class="Special"> <- </span>get *sandbox, <span class="Constant">data:offset</span> + current-sandbox:address:editor-data<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> + *env<span class="Special"> <- </span>put *env, <span class="Constant">render-from:offset</span>, <span class="Constant">-1</span> + <span class="Comment"># position cursor in sandbox editor</span> + *env<span class="Special"> <- </span>put *env, <span class="Constant">sandbox-in-focus?:offset</span>, <span class="Constant">1/true</span> +] + +<span class="muScenario">scenario</span> sandbox-with-print-can-be-edited [ + trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">20/height</span> + <span class="Comment"># left editor is empty</span> + <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> + <span class="Comment"># right editor contains an instruction</span> + <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[print-integer screen, 4]</span> + <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character + <span class="Comment"># run the sandbox</span> + assume-console [ + press F4 + ] + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊print-integer screen, 4 .</span> + <span class="Constant"> . ┊screen: .</span> + <span class="Constant"> . ┊ .4 . .</span> + <span class="Constant"> . ┊ . . .</span> + <span class="Constant"> . ┊ . . .</span> + <span class="Constant"> . ┊ . . .</span> + <span class="Constant"> . ┊ . . .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># edit the sandbox</span> + assume-console [ + left-click <span class="Constant">3</span>, <span class="Constant">65</span> + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊print-integer screen, 4 .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> . ┊ .</span> + ] +] + +<span class="muScenario">scenario</span> editing-sandbox-after-scrolling-resets-scroll [ + trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> + <span class="Comment"># initialize environment</span> + <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> + <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> + <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character + render-all screen, <span class="Constant">3</span>:address:programming-environment-data + <span class="Comment"># create 2 sandboxes and scroll to second</span> + assume-console [ + press ctrl-n + type <span class="Constant">[add 2, 2]</span> + press F4 + type <span class="Constant">[add 1, 1]</span> + press F4 + press page-down + press page-down + ] + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] + <span class="Comment"># edit the second sandbox</span> + assume-console [ + left-click <span class="Constant">2</span>, <span class="Constant">55</span> + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + <span class="Comment"># second sandbox shows in editor; scroll resets to display first sandbox</span> + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊add 2, 2 .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] +] + +<span class="muScenario">scenario</span> editing-sandbox-updates-sandbox-count [ + trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> + <span class="Comment"># initialize environment</span> + <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> + <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> + <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character + render-all screen, <span class="Constant">3</span>:address:programming-environment-data + <span class="Comment"># create 2 sandboxes</span> + assume-console [ + press ctrl-n + type <span class="Constant">[add 2, 2]</span> + press F4 + type <span class="Constant">[add 1, 1]</span> + press F4 + ] + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + ] + <span class="Comment"># edit the second sandbox, then resave</span> + assume-console [ + left-click <span class="Constant">3</span>, <span class="Constant">60</span> + press F4 + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + <span class="Comment"># no change in contents</span> + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> + <span class="Constant"> . ┊add 1, 1 .</span> + <span class="Constant"> . ┊2 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + ] + <span class="Comment"># now try to scroll past end</span> + assume-console [ + press page-down + press page-down + press page-down + ] + run [ + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + ] + <span class="Comment"># screen should show just final sandbox with the right index (1)</span> + screen-should-contain [ + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊1 edit copy delete .</span> + <span class="Constant"> . ┊add 2, 2 .</span> + <span class="Constant"> . ┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + ] +] +</pre> +</body> +</html> +<!-- vim: set foldmethod=manual : --> diff --git a/html/edit/008-sandbox-test.mu.html b/html/edit/009-sandbox-test.mu.html index 69a4fd5c..5d7e782a 100644 --- a/html/edit/008-sandbox-test.mu.html +++ b/html/edit/009-sandbox-test.mu.html @@ -2,7 +2,7 @@ <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> -<title>Mu - edit/008-sandbox-test.mu</title> +<title>Mu - edit/009-sandbox-test.mu</title> <meta name="Generator" content="Vim/7.4"> <meta name="plugin-version" content="vim7.4_v2"> <meta name="syntax" content="none"> @@ -37,7 +37,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> sandbox-click-on-result-toggles-color-to-green [ trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">40/width</span>, <span class="Constant">10/height</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># basic recipe</span> <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> @@ -51,32 +51,32 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data screen-should-contain [ - <span class="Constant"> . run (F4) .</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . reply 4 ┊0 x.</span> - <span class="Constant"> .] ┊foo .</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] <span class="Comment"># click on the '4' in the result</span> assume-console [ - left-click <span class="Constant">5</span>, <span class="Constant">21</span> + left-click <span class="Constant">5</span>, <span class="Constant">51</span> ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data ] <span class="Comment"># color toggles to green</span> screen-should-contain-in-color <span class="Constant">2/green</span>, [ - <span class="Constant"> . .</span> - <span class="Constant"> . .</span> - <span class="Constant"> . .</span> - <span class="Constant"> . .</span> - <span class="Constant"> . .</span> - <span class="Constant"> . 4 .</span> - <span class="Constant"> . .</span> - <span class="Constant"> . .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . 4 .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . .</span> ] <span class="Comment"># cursor should remain unmoved</span> run [ @@ -84,14 +84,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color print screen:address:screen, <span class="Constant">4</span>:character/cursor ] screen-should-contain [ - <span class="Constant"> . run (F4) .</span> - <span class="Constant"> .␣ ┊ .</span> - <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . reply 4 ┊0 x.</span> - <span class="Constant"> .] ┊foo .</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> .␣ ┊ .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . reply 4 ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> . ┊ .</span> ] <span class="Comment"># now change the result</span> <span class="Comment"># then rerun</span> @@ -106,14 +108,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># result turns red</span> screen-should-contain-in-color <span class="Constant">1/red</span>, [ - <span class="Constant"> . .</span> - <span class="Constant"> . .</span> - <span class="Constant"> . .</span> - <span class="Constant"> . .</span> - <span class="Constant"> . .</span> - <span class="Constant"> . 3 .</span> - <span class="Constant"> . .</span> - <span class="Constant"> . .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . 3 .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . .</span> ] ] @@ -134,7 +136,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muRecipe">before</span> <span class="Constant"><end-restore-sandbox></span> [ - *curr<span class="Special"> <- </span>put *curr, <span class="Constant">expected-response:offset</span>, contents + <span class="Delimiter">{</span> + filename<span class="Special"> <- </span>append filename, <span class="Constant">[.out]</span> + contents<span class="Special"> <- </span>restore filename + <span class="muControl">break-unless</span> contents + *curr<span class="Special"> <- </span>put *curr, <span class="Constant">expected-response:offset</span>, contents + <span class="Delimiter">}</span> ] <span class="Comment"># clicks on sandbox responses save it as 'expected'</span> diff --git a/html/edit/009-sandbox-trace.mu.html b/html/edit/010-sandbox-trace.mu.html index c6d30308..282d2463 100644 --- a/html/edit/009-sandbox-trace.mu.html +++ b/html/edit/010-sandbox-trace.mu.html @@ -2,7 +2,7 @@ <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> -<title>Mu - edit/009-sandbox-trace.mu</title> +<title>Mu - edit/010-sandbox-trace.mu</title> <meta name="Generator" content="Vim/7.4"> <meta name="plugin-version" content="vim7.4_v2"> <meta name="syntax" content="none"> @@ -37,7 +37,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> sandbox-click-on-code-toggles-app-trace [ trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">40/width</span>, <span class="Constant">10/height</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># basic recipe</span> <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> @@ -51,17 +51,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data screen-should-contain [ - <span class="Constant"> . run (F4) .</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . stash [abc] ┊0 x.</span> - <span class="Constant"> .] ┊foo .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . stash [abc] ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] <span class="Comment"># click on the code in the sandbox</span> assume-console [ - left-click <span class="Constant">4</span>, <span class="Constant">21</span> + left-click <span class="Constant">4</span>, <span class="Constant">51</span> ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data @@ -70,28 +70,28 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># trace now printed and cursor shouldn't have budged</span> screen-should-contain [ - <span class="Constant"> . run (F4) .</span> - <span class="Constant"> .␣ ┊ .</span> - <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . stash [abc] ┊0 x.</span> - <span class="Constant"> .] ┊foo .</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊abc .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> .␣ ┊ .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . stash [abc] ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊abc .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] screen-should-contain-in-color <span class="Constant">245/grey</span>, [ - <span class="Constant"> . .</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ x.</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊abc .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊abc .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] <span class="Comment"># click again on the same region</span> assume-console [ - left-click <span class="Constant">4</span>, <span class="Constant">25</span> + left-click <span class="Constant">4</span>, <span class="Constant">55</span> ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data @@ -99,19 +99,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># trace hidden again</span> screen-should-contain [ - <span class="Constant"> . run (F4) .</span> - <span class="Constant"> .␣ ┊ .</span> - <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . stash [abc] ┊0 x.</span> - <span class="Constant"> .] ┊foo .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> .␣ ┊ .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . stash [abc] ┊0 edit copy delete .</span> + <span class="Constant"> .] ┊foo .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] ] <span class="muScenario">scenario</span> sandbox-shows-app-trace-and-result [ trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> - assume-screen <span class="Constant">40/width</span>, <span class="Constant">10/height</span> + assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> <span class="Comment"># basic recipe</span> <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> @@ -126,33 +126,33 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data screen-should-contain [ - <span class="Constant"> . run (F4) .</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . stash [abc] ┊0 x.</span> - <span class="Constant"> . reply 4 ┊foo .</span> - <span class="Constant"> .] ┊4 .</span> -<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . stash [abc] ┊0 edit copy delete .</span> + <span class="Constant"> . reply 4 ┊foo .</span> + <span class="Constant"> .] ┊4 .</span> +<span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] <span class="Comment"># click on the code in the sandbox</span> assume-console [ - left-click <span class="Constant">4</span>, <span class="Constant">21</span> + left-click <span class="Constant">4</span>, <span class="Constant">51</span> ] run [ event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data ] <span class="Comment"># trace now printed above result</span> screen-should-contain [ - <span class="Constant"> . run (F4) .</span> - <span class="Constant"> . ┊ .</span> - <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . stash [abc] ┊0 x.</span> - <span class="Constant"> . reply 4 ┊foo .</span> - <span class="Constant"> .] ┊abc .</span> - <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> - <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ .</span> + <span class="Constant"> . run (F4) .</span> + <span class="Constant"> . ┊ .</span> + <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . stash [abc] ┊0 edit copy delete .</span> + <span class="Constant"> . reply 4 ┊foo .</span> + <span class="Constant"> .] ┊abc .</span> + <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> + <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> + <span class="Constant"> . ┊ .</span> ] ] diff --git a/html/edit/010-errors.mu.html b/html/edit/011-errors.mu.html index d1627ae7..9689ea9f 100644 --- a/html/edit/010-errors.mu.html +++ b/html/edit/011-errors.mu.html @@ -2,7 +2,7 @@ <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> -<title>Mu - edit/010-errors.mu</title> +<title>Mu - edit/011-errors.mu</title> <meta name="Generator" content="Vim/7.4"> <meta name="plugin-version" content="vim7.4_v2"> <meta name="syntax" content="none"> @@ -170,9 +170,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> <span class="Constant"> . get 123:number, foo:offset ┊ .</span> <span class="Constant"> .] ┊ .</span> - <span class="Constant"> .foo: unknown element foo in container number ┊ .</span> + <span class="Constant"> .foo: unknown element 'foo' in container 'number' ┊ .</span> <span class="Constant"> .foo: first ingredient of 'get' should be a contai↩┊ .</span> - <span class="Constant"> .ner, but got 123:number ┊ .</span> + <span class="Constant"> .ner, but got '123:number' ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ .</span> <span class="Constant"> . ┊ .</span> ] @@ -182,9 +182,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . .</span> <span class="Constant"> . .</span> <span class="Constant"> . .</span> - <span class="Constant"> .foo: unknown element foo in container number .</span> + <span class="Constant"> .foo: unknown element 'foo' in container 'number' .</span> <span class="Constant"> .foo: first ingredient of 'get' should be a contai .</span> - <span class="Constant"> .ner, but got 123:number .</span> + <span class="Constant"> .ner, but got '123:number' .</span> <span class="Constant"> . .</span> ] ] @@ -253,7 +253,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data ] assume-console [ - left-click <span class="Constant">3</span>, <span class="Constant">80</span> + left-click <span class="Constant">3</span>, <span class="Constant">58</span> press ctrl-k type <span class="Constant">[add 2, 2]</span> <span class="Comment"># valid code</span> press F4 <span class="Comment"># update sandbox</span> @@ -266,7 +266,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> <span class="Constant"> . ┊add 2, 2 .</span> <span class="Constant"> . ┊4 .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> @@ -294,10 +294,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . errors found (0) run (F4) .</span> <span class="Constant"> .recipe foo x:_elem -> z:_elem [ ┊ .</span> <span class="Constant"> .local-scope ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> .load-ingredients ┊0 x.</span> + <span class="Constant"> .load-ingredients ┊0 edit copy delete .</span> <span class="Constant"> .y:address:number <- copy 0 ┊foo 2 .</span> <span class="Constant"> .z <- add x, y ┊foo_2: 'add' requires number ingredients, but go↩.</span> - <span class="Constant"> .] ┊t y .</span> + <span class="Constant"> .] ┊t 'y' .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> <span class="Constant"> . ┊ .</span> ] @@ -313,10 +313,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . errors found (0) run (F4) .</span> <span class="Constant"> .recipe foo x:_elem -> z:_elem [ ┊ .</span> <span class="Constant"> .local-scope ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> .load-ingredients ┊0 x.</span> + <span class="Constant"> .load-ingredients ┊0 edit copy delete .</span> <span class="Constant"> .y:address:number <- copy 0 ┊foo 2 .</span> <span class="Constant"> .z <- add x, y ┊foo_3: 'add' requires number ingredients, but go↩.</span> - <span class="Constant"> .] ┊t y .</span> + <span class="Constant"> .] ┊t 'y' .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> <span class="Constant"> . ┊ .</span> ] @@ -403,7 +403,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> <span class="Constant"> . x <- copy 0 ┊ .</span> <span class="Constant"> .] ┊ .</span> - <span class="Constant"> .foo: missing type for x in 'x <- copy 0' ┊ .</span> + <span class="Constant"> .foo: missing type for 'x' in 'x <- copy 0' ┊ .</span> ] ] @@ -462,7 +462,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . get x:address:point, 1:offset ┊ .</span> <span class="Constant"> .] ┊ .</span> <span class="Constant"> .foo: first ingredient of 'get' should be a contai↩┊ .</span> - <span class="Constant"> .ner, but got x:address:point ┊ .</span> + <span class="Constant"> .ner, but got 'x:address:point' ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ .</span> <span class="Constant"> . ┊ .</span> ] @@ -496,7 +496,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . get *y:address:point, x:number ┊ .</span> <span class="Constant"> .] ┊ .</span> <span class="Constant"> .foo: second ingredient of 'get' should have type ↩┊ .</span> - <span class="Constant"> .'offset', but got x:number ┊ .</span> + <span class="Constant"> .'offset', but got 'x:number' ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ .</span> <span class="Constant"> . ┊ .</span> ] @@ -524,7 +524,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . local-scope ┊ .</span> <span class="Constant"> . x:number <- copy y:number ┊ .</span> <span class="Constant"> .] ┊ .</span> - <span class="Constant"> .foo: use before set: y ┊ .</span> + <span class="Constant"> .foo: use before set: 'y' ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ .</span> <span class="Constant"> . ┊ .</span> ] @@ -542,7 +542,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . local-scope ┊ .</span> <span class="Constant"> . x:number <- copy y:number ┊ .</span> <span class="Constant"> .] ┊ .</span> - <span class="Constant"> .foo: use before set: y ┊ .</span> + <span class="Constant"> .foo: use before set: 'y' ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ .</span> <span class="Constant"> . ┊ .</span> ] @@ -568,11 +568,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . errors found (0) run (F4) .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> <span class="Constant"> . ┊get 1234:number, foo:offset .</span> - <span class="Constant"> . ┊unknown element foo in container number .</span> + <span class="Constant"> . ┊unknown element 'foo' in container 'number' .</span> <span class="Constant"> . ┊first ingredient of 'get' should be a container,↩.</span> - <span class="Constant"> . ┊ but got 1234:number .</span> + <span class="Constant"> . ┊ but got '1234:number' .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> <span class="Constant"> . ┊ .</span> ] @@ -592,16 +592,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . .</span> <span class="Constant"> . .</span> <span class="Constant"> . .</span> - <span class="Constant"> . unknown element foo in container number .</span> + <span class="Constant"> . unknown element 'foo' in container 'number' .</span> <span class="Constant"> . first ingredient of 'get' should be a container, .</span> - <span class="Constant"> . but got 1234:number .</span> + <span class="Constant"> . but got '1234:number' .</span> <span class="Constant"> . .</span> ] screen-should-contain-in-color <span class="Constant">245/grey</span>, [ <span class="Constant"> . .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊ x.</span> + <span class="Constant"> . ┊ .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> . ┊ ↩.</span> @@ -632,11 +632,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . errors found (0) run (F4) .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . ┊0 x.</span> + <span class="Constant"> . ┊0 edit copy delete .</span> <span class="Constant"> . ┊get 1234:number, foo:offset .</span> - <span class="Constant"> . ┊unknown element foo in container number .</span> + <span class="Constant"> . ┊unknown element 'foo' in container 'number' .</span> <span class="Constant"> . ┊first ingredient of 'get' should be a container,↩.</span> - <span class="Constant"> . ┊ but got 1234:number .</span> + <span class="Constant"> . ┊ but got '1234:number' .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> <span class="Constant"> . ┊ .</span> ] @@ -665,7 +665,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . errors found (0) run (F4) .</span> <span class="Constant"> .recipe foo [ ┊ .</span> <span class="Constant"> . { ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . loop ┊0 x.</span> + <span class="Constant"> . loop ┊0 edit copy delete .</span> <span class="Constant"> . } ┊foo .</span> <span class="Constant"> .] ┊took too long! .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> @@ -697,7 +697,7 @@ _, c:number<span class="Special"> <- </span>divide-with-remainder a, b <span class="Constant"> . errors found (0) run (F4) .</span> <span class="Constant"> .recipe foo [ ┊ .</span> <span class="Constant"> .local-scope ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> .a:number <- next-ingredient ┊0 x.</span> + <span class="Constant"> .a:number <- next-ingredient ┊0 edit copy delete .</span> <span class="Constant"> .b:number <- next-ingredient ┊foo 4, 0 .</span> <span class="Constant"> .stash [dividing by], b ┊foo: divide by zero in '_, c:number <- divide-wi↩.</span> <span class="Constant"> ._, c:number <- divide-with-remainder a, b ┊th-remainder a, b' .</span> @@ -716,7 +716,7 @@ _, c:number<span class="Special"> <- </span>divide-with-remainder a, b <span class="Constant"> . errors found (0) run (F4) .</span> <span class="Constant"> .recipe foo [ ┊ .</span> <span class="Constant"> .local-scope ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> .a:number <- next-ingredient ┊0 x.</span> + <span class="Constant"> .a:number <- next-ingredient ┊0 edit copy delete .</span> <span class="Constant"> .b:number <- next-ingredient ┊foo 4, 0 .</span> <span class="Constant"> .stash [dividing by], b ┊dividing by 0 .</span> <span class="Constant"> ._, c:number <- divide-with-remainder a, b ┊foo: divide by zero in '_, c:number <- divide-wi↩.</span> diff --git a/html/edit/011-editor-undo.mu.html b/html/edit/012-editor-undo.mu.html index 18d6843a..0518d0ad 100644 --- a/html/edit/011-editor-undo.mu.html +++ b/html/edit/012-editor-undo.mu.html @@ -2,7 +2,7 @@ <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> -<title>Mu - edit/011-editor-undo.mu</title> +<title>Mu - edit/012-editor-undo.mu</title> <meta name="Generator" content="Vim/7.4"> <meta name="plugin-version" content="vim7.4_v2"> <meta name="syntax" content="none"> @@ -1655,7 +1655,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color undo:address:list:address:operation<span class="Special"> <- </span>get *editor, <span class="Constant">undo:offset</span> <span class="Delimiter">{</span> <span class="Comment"># if previous operation was an insert, coalesce this operation with it</span> - <span class="muControl">break-unless</span> *undo + <span class="muControl">break-unless</span> undo op:address:operation<span class="Special"> <- </span>first undo deletion:delete-operation, is-delete?:boolean<span class="Special"> <- </span>maybe-convert *op, <span class="Constant">delete:variant</span> <span class="muControl">break-unless</span> is-delete? |