diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-07-27 17:07:52 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-07-27 17:08:29 -0700 |
commit | 5fe060d582d4a82444243a28b18085c971a85628 (patch) | |
tree | 7a13eb020d0a9cab5d4195da931a373f575229ab /html/edit/006-sandbox-copy.mu.html | |
parent | 013d95266d563a3f531c13eba6d2a6bfe18f8808 (diff) | |
download | mu-5fe060d582d4a82444243a28b18085c971a85628.tar.gz |
4447
Diffstat (limited to 'html/edit/006-sandbox-copy.mu.html')
-rw-r--r-- | html/edit/006-sandbox-copy.mu.html | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/html/edit/006-sandbox-copy.mu.html b/html/edit/006-sandbox-copy.mu.html index 57c581a7..fe119f1e 100644 --- a/html/edit/006-sandbox-copy.mu.html +++ b/html/edit/006-sandbox-copy.mu.html @@ -15,16 +15,16 @@ body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color a { color:#eeeeee; text-decoration: none; } a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } +.Delimiter { color: #800080; } .muRecipe { color: #ff8700; } -.muScenario { color: #00af00; } .Special { color: #c00000; } -.Delimiter { color: #800080; } .SalientComment { color: #00ffff; } .Constant { color: #00a0a0; } .LineNr { color: #444444; } +.muControl { color: #c0a020; } .Comment { color: #9090ff; } .Comment a { color:#0000ee; text-decoration:underline; } -.muControl { color: #c0a020; } +.muScenario { color: #00af00; } --> </style> @@ -70,7 +70,7 @@ if ('onhashchange' in window) { <span id="L9" class="LineNr"> 9 </span> assume-resources [ <span id="L10" class="LineNr"> 10 </span> ] <span id="L11" class="LineNr"> 11 </span> env:&:environment <span class="Special"><-</span> <a href='004-programming-environment.mu.html#L21'>new-programming-environment</a> <a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L16'>screen</a>, <span class="Constant">[add 1, 1]</span> <span class="Comment"># contents of sandbox editor</span> -<span id="L12" class="LineNr"> 12 </span> <a href='004-programming-environment.mu.html#L402'>render-all</a> <a href='../081print.mu.html#L16'>screen</a>, env, <a href='001-editor.mu.html#L107'>render</a> +<span id="L12" class="LineNr"> 12 </span> <a href='004-programming-environment.mu.html#L402'>render-all</a> <a href='../081print.mu.html#L16'>screen</a>, env, <a href='001-editor.mu.html#L109'>render</a> <span id="L13" class="LineNr"> 13 </span> <span class="Comment"># run it</span> <span id="L14" class="LineNr"> 14 </span> assume-console [ <span id="L15" class="LineNr"> 15 </span> press F4 @@ -131,7 +131,7 @@ if ('onhashchange' in window) { <span id="L70" class="LineNr"> 70 </span> assume-resources [ <span id="L71" class="LineNr"> 71 </span> ] <span id="L72" class="LineNr"> 72 </span> env:&:environment <span class="Special"><-</span> <a href='004-programming-environment.mu.html#L21'>new-programming-environment</a> <a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L16'>screen</a>, <span class="Constant">[add 1, 1]</span> <span class="Comment"># contents of sandbox editor</span> -<span id="L73" class="LineNr"> 73 </span> <a href='004-programming-environment.mu.html#L402'>render-all</a> <a href='../081print.mu.html#L16'>screen</a>, env, <a href='001-editor.mu.html#L107'>render</a> +<span id="L73" class="LineNr"> 73 </span> <a href='004-programming-environment.mu.html#L402'>render-all</a> <a href='../081print.mu.html#L16'>screen</a>, env, <a href='001-editor.mu.html#L109'>render</a> <span id="L74" class="LineNr"> 74 </span> <span class="Comment"># run it</span> <span id="L75" class="LineNr"> 75 </span> assume-console [ <span id="L76" class="LineNr"> 76 </span> press F4 @@ -191,7 +191,7 @@ if ('onhashchange' in window) { <span id="L130" class="LineNr">130 </span> <span class="muControl">break-unless</span> copy? <span id="L131" class="LineNr">131 </span> copy?, env <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L159'>try-copy-sandbox</a> click-row, env <span id="L132" class="LineNr">132 </span> <span class="muControl">break-unless</span> copy? -<span id="L133" class="LineNr">133 </span> <a href='../081print.mu.html#L16'>screen</a> <span class="Special"><-</span> render-sandbox-side <a href='../081print.mu.html#L16'>screen</a>, env, <a href='001-editor.mu.html#L107'>render</a> +<span id="L133" class="LineNr">133 </span> <a href='../081print.mu.html#L16'>screen</a> <span class="Special"><-</span> render-sandbox-side <a href='../081print.mu.html#L16'>screen</a>, env, <a href='001-editor.mu.html#L109'>render</a> <span id="L134" class="LineNr">134 </span> <a href='../081print.mu.html#L16'>screen</a> <span class="Special"><-</span> <a href='004-programming-environment.mu.html#L468'>update-cursor</a> <a href='../081print.mu.html#L16'>screen</a>, recipes, current-sandbox, sandbox-in-focus?, env <span id="L135" class="LineNr">135 </span> <span class="muControl"> loop</span> <span class="Constant">+next-event</span> <span id="L136" class="LineNr">136 </span> <span class="Delimiter">}</span> @@ -203,7 +203,7 @@ if ('onhashchange' in window) { <span id="L142" class="LineNr">142 </span> <span class="Constant">load-inputs</span> <span id="L143" class="LineNr">143 </span> <span class="Comment"># are we below the sandbox editor?</span> <span id="L144" class="LineNr">144 </span> click-sandbox-area?:bool <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L190'>click-on-sandbox-area?</a> click-row, click-column, env -<span id="L145" class="LineNr">145 </span> <span class="muControl">return-unless</span> click-sandbox-area?, <span class="Constant">0/false</span> +<span id="L145" class="LineNr">145 </span> <span class="muControl">return-unless</span> click-sandbox-area?,<span class="Constant"> false</span> <span id="L146" class="LineNr">146 </span> <span class="Comment"># narrower, is the click in the columns spanning the 'copy' button?</span> <span id="L147" class="LineNr">147 </span> first-sandbox:&:editor <span class="Special"><-</span> get *env, <span class="Constant">current-sandbox:offset</span> <span id="L148" class="LineNr">148 </span> assert first-sandbox, <span class="Constant">[!!]</span> @@ -211,7 +211,7 @@ if ('onhashchange' in window) { <span id="L150" class="LineNr">150 </span> sandbox-right-margin:num <span class="Special"><-</span> get *first-sandbox, <span class="Constant">right:offset</span> <span id="L151" class="LineNr">151 </span> _, _, copy-button-left:num, copy-button-right:num <span class="Special"><-</span> <a href='005-sandbox.mu.html#L376'>sandbox-menu-columns</a> sandbox-left-margin, sandbox-right-margin <span id="L152" class="LineNr">152 </span> copy-button-vertical-area?:bool <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L211'>within-range?</a> click-column, copy-button-left, copy-button-right -<span id="L153" class="LineNr">153 </span> <span class="muControl">return-unless</span> copy-button-vertical-area?, <span class="Constant">0/false</span> +<span id="L153" class="LineNr">153 </span> <span class="muControl">return-unless</span> copy-button-vertical-area?,<span class="Constant"> false</span> <span id="L154" class="LineNr">154 </span> <span class="Comment"># finally, is sandbox editor empty?</span> <span id="L155" class="LineNr">155 </span> current-sandbox:&:editor <span class="Special"><-</span> get *env, <span class="Constant">current-sandbox:offset</span> <span id="L156" class="LineNr">156 </span> result <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L203'>empty-editor?</a> current-sandbox @@ -222,15 +222,15 @@ if ('onhashchange' in window) { <span id="L161" class="LineNr">161 </span> <span class="Constant">load-inputs</span> <span id="L162" class="LineNr">162 </span> <span class="Comment"># identify the sandbox to copy, if the click was actually on the 'copy' button</span> <span id="L163" class="LineNr">163 </span> sandbox:&:sandbox <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L175'>find-sandbox</a> env, click-row -<span id="L164" class="LineNr">164 </span> <span class="muControl">return-unless</span> sandbox, <span class="Constant">0/false</span> -<span id="L165" class="LineNr">165 </span> clicked-on-copy-button? <span class="Special"><-</span> copy <span class="Constant">1/true</span> +<span id="L164" class="LineNr">164 </span> <span class="muControl">return-unless</span> sandbox,<span class="Constant"> false</span> +<span id="L165" class="LineNr">165 </span> clicked-on-copy-button? <span class="Special"><-</span> copy<span class="Constant"> true</span> <span id="L166" class="LineNr">166 </span> text:text <span class="Special"><-</span> get *sandbox, <span class="Constant">data:offset</span> <span id="L167" class="LineNr">167 </span> current-sandbox:&:editor <span class="Special"><-</span> get *env, <span class="Constant">current-sandbox:offset</span> <span id="L168" class="LineNr">168 </span> current-sandbox <span class="Special"><-</span> <a href='001-editor.mu.html#L72'>insert-text</a> current-sandbox, text <span id="L169" class="LineNr">169 </span> <span class="Comment"># reset scroll</span> <span id="L170" class="LineNr">170 </span> *env <span class="Special"><-</span> put *env, <span class="Constant">render-from:offset</span>,<span class="Constant"> -1</span> <span id="L171" class="LineNr">171 </span> <span class="Comment"># position cursor in sandbox editor</span> -<span id="L172" class="LineNr">172 </span> *env <span class="Special"><-</span> put *env, <span class="Constant">sandbox-in-focus?:offset</span>, <span class="Constant">1/true</span> +<span id="L172" class="LineNr">172 </span> *env <span class="Special"><-</span> put *env, <span class="Constant">sandbox-in-focus?:offset</span>,<span class="Constant"> true</span> <span id="L173" class="LineNr">173 </span>] <span id="L174" class="LineNr">174 </span> <span id="L175" class="LineNr">175 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L175'>find-sandbox</a> env:&:environment, click-row:num<span class="muRecipe"> -> </span>result:&:sandbox [ @@ -245,7 +245,7 @@ if ('onhashchange' in window) { <span id="L184" class="LineNr">184 </span> curr-sandbox <span class="Special"><-</span> get *curr-sandbox, <span class="Constant">next-sandbox:offset</span> <span id="L185" class="LineNr">185 </span> <span class="muControl"> loop</span> <span id="L186" class="LineNr">186 </span> <span class="Delimiter">}</span> -<span id="L187" class="LineNr">187 </span> <span class="muControl"> return</span> <span class="Constant">0/not-found</span> +<span id="L187" class="LineNr">187 </span> <span class="muControl"> return</span><span class="Constant"> null/not-found</span> <span id="L188" class="LineNr">188 </span>] <span id="L189" class="LineNr">189 </span> <span id="L190" class="LineNr">190 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L190'>click-on-sandbox-area?</a> click-row:num, click-column:num, env:&:environment<span class="muRecipe"> -> </span>result:bool [ @@ -254,9 +254,9 @@ if ('onhashchange' in window) { <span id="L193" class="LineNr">193 </span> current-sandbox:&:editor <span class="Special"><-</span> get *env, <span class="Constant">current-sandbox:offset</span> <span id="L194" class="LineNr">194 </span> sandbox-left-margin:num <span class="Special"><-</span> get *current-sandbox, <span class="Constant">left:offset</span> <span id="L195" class="LineNr">195 </span> on-sandbox-side?:bool <span class="Special"><-</span> greater-or-equal click-column, sandbox-left-margin -<span id="L196" class="LineNr">196 </span> <span class="muControl">return-unless</span> on-sandbox-side?, <span class="Constant">0/false</span> +<span id="L196" class="LineNr">196 </span> <span class="muControl">return-unless</span> on-sandbox-side?,<span class="Constant"> false</span> <span id="L197" class="LineNr">197 </span> first-sandbox:&:sandbox <span class="Special"><-</span> get *env, <span class="Constant">sandbox:offset</span> -<span id="L198" class="LineNr">198 </span> <span class="muControl">return-unless</span> first-sandbox, <span class="Constant">0/false</span> +<span id="L198" class="LineNr">198 </span> <span class="muControl">return-unless</span> first-sandbox,<span class="Constant"> false</span> <span id="L199" class="LineNr">199 </span> first-sandbox-begins:num <span class="Special"><-</span> get *first-sandbox, <span class="Constant">starting-row-on-screen:offset</span> <span id="L200" class="LineNr">200 </span> result <span class="Special"><-</span> greater-or-equal click-row, first-sandbox-begins <span id="L201" class="LineNr">201 </span>] @@ -265,7 +265,7 @@ if ('onhashchange' in window) { <span id="L204" class="LineNr">204 </span> <span class="Constant">local-scope</span> <span id="L205" class="LineNr">205 </span> <span class="Constant">load-inputs</span> <span id="L206" class="LineNr">206 </span> head:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> -<span id="L207" class="LineNr">207 </span> first:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L25'>next</a> head +<span id="L207" class="LineNr">207 </span> first:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L31'>next</a> head <span id="L208" class="LineNr">208 </span> result <span class="Special"><-</span> not first <span id="L209" class="LineNr">209 </span>] <span id="L210" class="LineNr">210 </span> @@ -285,7 +285,7 @@ if ('onhashchange' in window) { <span id="L224" class="LineNr">224 </span> assume-resources [ <span id="L225" class="LineNr">225 </span> ] <span id="L226" class="LineNr">226 </span> env:&:environment <span class="Special"><-</span> <a href='004-programming-environment.mu.html#L21'>new-programming-environment</a> <a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L16'>screen</a>, <span class="Constant">[add 1, 1]</span> <span class="Comment"># contents of sandbox editor</span> -<span id="L227" class="LineNr">227 </span> <a href='004-programming-environment.mu.html#L402'>render-all</a> <a href='../081print.mu.html#L16'>screen</a>, env, <a href='001-editor.mu.html#L107'>render</a> +<span id="L227" class="LineNr">227 </span> <a href='004-programming-environment.mu.html#L402'>render-all</a> <a href='../081print.mu.html#L16'>screen</a>, env, <a href='001-editor.mu.html#L109'>render</a> <span id="L228" class="LineNr">228 </span> <span class="Comment"># run it</span> <span id="L229" class="LineNr">229 </span> assume-console [ <span id="L230" class="LineNr">230 </span> press F4 @@ -350,7 +350,7 @@ if ('onhashchange' in window) { <span id="L289" class="LineNr">289 </span> assume-resources [ <span id="L290" class="LineNr">290 </span> ] <span id="L291" class="LineNr">291 </span> env:&:environment <span class="Special"><-</span> <a href='004-programming-environment.mu.html#L21'>new-programming-environment</a> <a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L16'>screen</a>, <span class="Constant">[add 1, 1]</span> <span class="Comment"># contents of sandbox editor</span> -<span id="L292" class="LineNr">292 </span> <a href='004-programming-environment.mu.html#L402'>render-all</a> <a href='../081print.mu.html#L16'>screen</a>, env, <a href='001-editor.mu.html#L107'>render</a> +<span id="L292" class="LineNr">292 </span> <a href='004-programming-environment.mu.html#L402'>render-all</a> <a href='../081print.mu.html#L16'>screen</a>, env, <a href='001-editor.mu.html#L109'>render</a> <span id="L293" class="LineNr">293 </span> <span class="Comment"># run it</span> <span id="L294" class="LineNr">294 </span> assume-console [ <span id="L295" class="LineNr">295 </span> press F4 @@ -410,8 +410,8 @@ if ('onhashchange' in window) { <span id="L349" class="LineNr">349 </span> <span class="muControl">break-unless</span> copy? <span id="L350" class="LineNr">350 </span> modified?:bool <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L375'>prepend-sandbox-into-recipe-side</a> click-row, env <span id="L351" class="LineNr">351 </span> <span class="muControl">break-unless</span> modified? -<span id="L352" class="LineNr">352 </span> *env <span class="Special"><-</span> put *env, <span class="Constant">sandbox-in-focus?:offset</span>, <span class="Constant">0/false</span> -<span id="L353" class="LineNr">353 </span> <a href='../081print.mu.html#L16'>screen</a> <span class="Special"><-</span> <a href='004-programming-environment.mu.html#L431'>render-recipes</a> <a href='../081print.mu.html#L16'>screen</a>, env, <a href='001-editor.mu.html#L107'>render</a> +<span id="L352" class="LineNr">352 </span> *env <span class="Special"><-</span> put *env, <span class="Constant">sandbox-in-focus?:offset</span>,<span class="Constant"> false</span> +<span id="L353" class="LineNr">353 </span> <a href='../081print.mu.html#L16'>screen</a> <span class="Special"><-</span> <a href='004-programming-environment.mu.html#L431'>render-recipes</a> <a href='../081print.mu.html#L16'>screen</a>, env, <a href='001-editor.mu.html#L109'>render</a> <span id="L354" class="LineNr">354 </span> <a href='../081print.mu.html#L16'>screen</a> <span class="Special"><-</span> <a href='004-programming-environment.mu.html#L468'>update-cursor</a> <a href='../081print.mu.html#L16'>screen</a>, recipes, current-sandbox, sandbox-in-focus?, env <span id="L355" class="LineNr">355 </span> <span class="muControl"> loop</span> <span class="Constant">+next-event</span> <span id="L356" class="LineNr">356 </span> <span class="Delimiter">}</span> @@ -423,7 +423,7 @@ if ('onhashchange' in window) { <span id="L362" class="LineNr">362 </span> <span class="Constant">load-inputs</span> <span id="L363" class="LineNr">363 </span> <span class="Comment"># are we below the sandbox editor?</span> <span id="L364" class="LineNr">364 </span> click-sandbox-area?:bool <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L190'>click-on-sandbox-area?</a> click-row, click-column, env -<span id="L365" class="LineNr">365 </span> <span class="muControl">return-unless</span> click-sandbox-area?, <span class="Constant">0/false</span> +<span id="L365" class="LineNr">365 </span> <span class="muControl">return-unless</span> click-sandbox-area?,<span class="Constant"> false</span> <span id="L366" class="LineNr">366 </span> <span class="Comment"># narrower, is the click in the columns spanning the 'copy' button?</span> <span id="L367" class="LineNr">367 </span> first-sandbox:&:editor <span class="Special"><-</span> get *env, <span class="Constant">current-sandbox:offset</span> <span id="L368" class="LineNr">368 </span> assert first-sandbox, <span class="Constant">[!!]</span> @@ -437,7 +437,7 @@ if ('onhashchange' in window) { <span id="L376" class="LineNr">376 </span> <span class="Constant">local-scope</span> <span id="L377" class="LineNr">377 </span> <span class="Constant">load-inputs</span> <span id="L378" class="LineNr">378 </span> sandbox:&:sandbox <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L175'>find-sandbox</a> env, click-row -<span id="L379" class="LineNr">379 </span> <span class="muControl">return-unless</span> sandbox, <span class="Constant">0/false</span> +<span id="L379" class="LineNr">379 </span> <span class="muControl">return-unless</span> sandbox,<span class="Constant"> false</span> <span id="L380" class="LineNr">380 </span> recipe-editor:&:editor <span class="Special"><-</span> get *env, <span class="Constant">recipes:offset</span> <span id="L381" class="LineNr">381 </span> recipe-data:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *recipe-editor, <span class="Constant">data:offset</span> <span id="L382" class="LineNr">382 </span> <span class="Comment"># make the newly inserted code easy to delineate</span> @@ -452,7 +452,7 @@ if ('onhashchange' in window) { <span id="L391" class="LineNr">391 </span> *recipe-editor <span class="Special"><-</span> put *recipe-editor, <span class="Constant">before-cursor:offset</span>, recipe-data <span id="L392" class="LineNr">392 </span> *recipe-editor <span class="Special"><-</span> put *recipe-editor, <span class="Constant">cursor-row:offset</span>,<span class="Constant"> 1</span> <span id="L393" class="LineNr">393 </span> *recipe-editor <span class="Special"><-</span> put *recipe-editor, <span class="Constant">cursor-column:offset</span>,<span class="Constant"> 0</span> -<span id="L394" class="LineNr">394 </span> <span class="muControl"> return</span> <span class="Constant">1/true</span> +<span id="L394" class="LineNr">394 </span> <span class="muControl"> return</span><span class="Constant"> true</span> <span id="L395" class="LineNr">395 </span>] </pre> </body> |