diff options
Diffstat (limited to 'html/edit/004-programming-environment.mu.html')
-rw-r--r-- | html/edit/004-programming-environment.mu.html | 89 |
1 files changed, 42 insertions, 47 deletions
diff --git a/html/edit/004-programming-environment.mu.html b/html/edit/004-programming-environment.mu.html index 39b29125..5b97c018 100644 --- a/html/edit/004-programming-environment.mu.html +++ b/html/edit/004-programming-environment.mu.html @@ -14,14 +14,13 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background- body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.muData { color: #ffff00; } .Special { color: #c00000; } .muScenario { color: #00af00; } .Delimiter { color: #800080; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } -.CommentedCode { color: #6c6c6c; } +.muData { color: #ffff00; } .muControl { color: #c0a020; } --> </style> @@ -119,7 +118,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-unless</span> is-touch? <span class="Comment"># ignore all but 'left-click' events for now</span> <span class="Comment"># todo: test this</span> - touch-type:num<span class="Special"> <- </span>get t, <span class="Constant">type:offset</span> + touch-type:num<span class="Special"> <- </span>get t, <span class="muData">type</span>:offset is-left-click?:bool<span class="Special"> <- </span>equal touch-type, <span class="Constant">65513/mouse-left</span> <span class="muControl">loop-unless</span> is-left-click?, <span class="Constant">+next-event:label</span> click-row:num<span class="Special"> <- </span>get t, <span class="Constant">row:offset</span> @@ -329,12 +328,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> point-at-multiple-editors [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">30/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize both halves of screen</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[def]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[abc]</span>, <span class="Constant">[def]</span> <span class="Comment"># focus on both sides</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">1</span> @@ -342,11 +340,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># check cursor column in each</span> run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:&:editor<span class="Special"> <- </span>get *<span class="Constant">3</span>:&:environment, <span class="Constant">recipes:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">4</span>:&:editor, <span class="Constant">cursor-column:offset</span> - <span class="Constant">6</span>:&:editor<span class="Special"> <- </span>get *<span class="Constant">3</span>:&:environment, <span class="Constant">current-sandbox:offset</span> - <span class="Constant">7</span>:num<span class="Special"> <- </span>get *<span class="Constant">6</span>:&:editor, <span class="Constant">cursor-column:offset</span> + event-loop screen:&:screen, console:&:console, env + recipes:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> + <span class="Constant">5</span>:num/<span class="Special">raw <- </span>get *recipes, <span class="Constant">cursor-column:offset</span> + sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + <span class="Constant">7</span>:num/<span class="Special">raw <- </span>get *sandbox, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -355,26 +353,25 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> edit-multiple-editors [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">30/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize both halves of screen</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[def]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[abc]</span>, <span class="Constant">[def]</span> + render-all screen, env, render <span class="Comment"># type one letter in each of them</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">1</span> - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> left-click <span class="Constant">1</span>, <span class="Constant">17</span> - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:&:editor<span class="Special"> <- </span>get *<span class="Constant">3</span>:&:environment, <span class="Constant">recipes:offset</span> - <span class="Constant">5</span>:num<span class="Special"> <- </span>get *<span class="Constant">4</span>:&:editor, <span class="Constant">cursor-column:offset</span> - <span class="Constant">6</span>:&:editor<span class="Special"> <- </span>get *<span class="Constant">3</span>:&:environment, <span class="Constant">current-sandbox:offset</span> - <span class="Constant">7</span>:num<span class="Special"> <- </span>get *<span class="Constant">6</span>:&:editor, <span class="Constant">cursor-column:offset</span> + event-loop screen:&:screen, console:&:console, env + recipes:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">recipes:offset</span> + <span class="Constant">5</span>:num/<span class="Special">raw <- </span>get *recipes, <span class="Constant">cursor-column:offset</span> + sandbox:&:editor<span class="Special"> <- </span>get *env, <span class="Constant">current-sandbox:offset</span> + <span class="Constant">7</span>:num/<span class="Special">raw <- </span>get *sandbox, <span class="Constant">cursor-column:offset</span> ] screen-should-contain [ <span class="Constant"> . run (F4) . # this line has a different background, but we don't test that yet</span> @@ -388,8 +385,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># show the cursor at the right window</span> run [ - <span class="Constant">8</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">8</span>:char/cursor + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -400,13 +397,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> multiple-editors-cover-only-their-own-areas [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">60/width</span>, <span class="Constant">10/height</span> run [ - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[def]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[abc]</span>, <span class="Constant">[def]</span> + render-all screen, env, render ] <span class="Comment"># divider isn't messed up</span> screen-should-contain [ @@ -419,18 +415,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-in-focus-keeps-cursor [ + <span class="Constant">local-scope</span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">30/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[def]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[abc]</span>, <span class="Constant">[def]</span> + render-all screen, env, render <span class="Comment"># initialize programming environment and highlight cursor</span> assume-console <span class="Constant">[]</span> run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># is cursor at the right place?</span> screen-should-contain [ @@ -441,12 +436,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># now try typing a letter</span> assume-console [ - type <span class="Constant">[z]</span> + <span class="muData">type</span> <span class="Constant">[z]</span> ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># cursor should still be right</span> screen-should-contain [ @@ -458,14 +453,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> backspace-in-sandbox-editor-joins-lines [ -<span class="CommentedCode">#? trace-until 100/app # trace too long</span> + <span class="Constant">local-scope</span> + trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">30/width</span>, <span class="Constant">5/height</span> <span class="Comment"># initialize sandbox side with two lines</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + s:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def]</span> - <span class="Constant">3</span>:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - render-all screen, <span class="Constant">3</span>:&:environment, render + env:&:environment<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">[]</span>, s:text + render-all screen, env, render screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊abc .</span> @@ -479,9 +474,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press backspace ] run [ - event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:environment - <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:&:screen, <span class="Constant">4</span>:char/cursor + event-loop screen:&:screen, console:&:console, env + cursor:char<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, cursor ] <span class="Comment"># cursor moves to end of old line</span> screen-should-contain [ |