diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-05-27 21:32:51 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-05-27 21:32:51 -0700 |
commit | 4f2adf06713eeec995d7811cd1d7a4dfe3cdda86 (patch) | |
tree | 92fc50fc557842bf4c7ef5a56d9c3ac07eac5ae7 /html/edit/006-sandbox-copy.mu.html | |
parent | 3c6cd5e8dca92d8b0073cecd18f5ab4bada1f9c1 (diff) | |
download | mu-4f2adf06713eeec995d7811cd1d7a4dfe3cdda86.tar.gz |
3883
Diffstat (limited to 'html/edit/006-sandbox-copy.mu.html')
-rw-r--r-- | html/edit/006-sandbox-copy.mu.html | 138 |
1 files changed, 126 insertions, 12 deletions
diff --git a/html/edit/006-sandbox-copy.mu.html b/html/edit/006-sandbox-copy.mu.html index 1fba95c1..e12c4729 100644 --- a/html/edit/006-sandbox-copy.mu.html +++ b/html/edit/006-sandbox-copy.mu.html @@ -80,7 +80,7 @@ if ('onhashchange' in window) { <span id="L18" class="LineNr"> 18 </span> <span class="Conceal">¦</span><span class="Constant"> . run (F4) .</span> <span id="L19" class="LineNr"> 19 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎ .</span> <span id="L20" class="LineNr"> 20 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────.</span> -<span id="L21" class="LineNr"> 21 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy delete .</span> +<span id="L21" class="LineNr"> 21 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy to recipe delete .</span> <span id="L22" class="LineNr"> 22 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎add 1, 1 .</span> <span id="L23" class="LineNr"> 23 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎2 .</span> <span id="L24" class="LineNr"> 24 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> @@ -98,7 +98,7 @@ if ('onhashchange' in window) { <span id="L36" class="LineNr"> 36 </span> <span class="Conceal">¦</span><span class="Constant"> . run (F4) .</span> <span id="L37" class="LineNr"> 37 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎add 1, 1 .</span> <span id="L38" class="LineNr"> 38 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────.</span> -<span id="L39" class="LineNr"> 39 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy delete .</span> +<span id="L39" class="LineNr"> 39 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy to recipe delete .</span> <span id="L40" class="LineNr"> 40 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎add 1, 1 .</span> <span id="L41" class="LineNr"> 41 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎2 .</span> <span id="L42" class="LineNr"> 42 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> @@ -115,7 +115,7 @@ if ('onhashchange' in window) { <span id="L53" class="LineNr"> 53 </span> <span class="Conceal">¦</span><span class="Constant"> . run (F4) .</span> <span id="L54" class="LineNr"> 54 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0add 1, 1 .</span> <span id="L55" class="LineNr"> 55 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────.</span> -<span id="L56" class="LineNr"> 56 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy delete .</span> +<span id="L56" class="LineNr"> 56 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy to recipe delete .</span> <span id="L57" class="LineNr"> 57 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎add 1, 1 .</span> <span id="L58" class="LineNr"> 58 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎2 .</span> <span id="L59" class="LineNr"> 59 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> @@ -140,7 +140,7 @@ if ('onhashchange' in window) { <span id="L78" class="LineNr"> 78 </span> <span class="Conceal">¦</span><span class="Constant"> . run (F4) .</span> <span id="L79" class="LineNr"> 79 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎ .</span> <span id="L80" class="LineNr"> 80 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────.</span> -<span id="L81" class="LineNr"> 81 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy delete .</span> +<span id="L81" class="LineNr"> 81 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy to recipe delete .</span> <span id="L82" class="LineNr"> 82 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎add 1, 1 .</span> <span id="L83" class="LineNr"> 83 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎2 .</span> <span id="L84" class="LineNr"> 84 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> @@ -148,7 +148,7 @@ if ('onhashchange' in window) { <span id="L86" class="LineNr"> 86 </span> ] <span id="L87" class="LineNr"> 87 </span> <span class="Comment"># click at right edge of 'copy' button (just before 'delete')</span> <span id="L88" class="LineNr"> 88 </span> assume-console [ -<span id="L89" class="LineNr"> 89 </span> <span class="Conceal">¦</span> left-click<span class="Constant"> 3</span>,<span class="Constant"> 84</span> +<span id="L89" class="LineNr"> 89 </span> <span class="Conceal">¦</span> left-click<span class="Constant"> 3</span>,<span class="Constant"> 76</span> <span id="L90" class="LineNr"> 90 </span> ] <span id="L91" class="LineNr"> 91 </span> run [ <span id="L92" class="LineNr"> 92 </span> <span class="Conceal">¦</span> <a href='004-programming-environment.mu.html#L39'>event-loop</a> <a href='../081print.mu.html#L4'>screen</a>, <a href='../084console.mu.html#L23'>console</a>, env, <a href='../088file.mu.html#L11'>resources</a> @@ -158,7 +158,7 @@ if ('onhashchange' in window) { <span id="L96" class="LineNr"> 96 </span> <span class="Conceal">¦</span><span class="Constant"> . run (F4) .</span> <span id="L97" class="LineNr"> 97 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎add 1, 1 .</span> <span id="L98" class="LineNr"> 98 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────.</span> -<span id="L99" class="LineNr"> 99 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy delete .</span> +<span id="L99" class="LineNr"> 99 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy to recipe delete .</span> <span id="L100" class="LineNr">100 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎add 1, 1 .</span> <span id="L101" class="LineNr">101 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎2 .</span> <span id="L102" class="LineNr">102 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> @@ -175,7 +175,7 @@ if ('onhashchange' in window) { <span id="L113" class="LineNr">113 </span> <span class="Conceal">¦</span><span class="Constant"> . run (F4) .</span> <span id="L114" class="LineNr">114 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0add 1, 1 .</span> <span id="L115" class="LineNr">115 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────.</span> -<span id="L116" class="LineNr">116 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy delete .</span> +<span id="L116" class="LineNr">116 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy to recipe delete .</span> <span id="L117" class="LineNr">117 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎add 1, 1 .</span> <span id="L118" class="LineNr">118 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎2 .</span> <span id="L119" class="LineNr">119 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> @@ -190,7 +190,7 @@ if ('onhashchange' in window) { <span id="L128" class="LineNr">128 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> copy? <span id="L129" class="LineNr">129 </span> <span class="Conceal">¦</span> copy?, env <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L157'>try-copy-sandbox</a> click-row, env <span id="L130" class="LineNr">130 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> copy? -<span id="L131" class="LineNr">131 </span> <span class="Conceal">¦</span> <a href='../081print.mu.html#L4'>screen</a> <span class="Special"><-</span> render-sandbox-side <a href='../081print.mu.html#L4'>screen</a>, env, <a href='001-editor.mu.html#L122'>render</a> +<span id="L131" class="LineNr">131 </span> <span class="Conceal">¦</span> <a href='../081print.mu.html#L4'>screen</a> <span class="Special"><-</span> render-sandbox-side <a href='../081print.mu.html#L4'>screen</a>, env, <a href='001-editor.mu.html#L107'>render</a> <span id="L132" class="LineNr">132 </span> <span class="Conceal">¦</span> <a href='../081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='004-programming-environment.mu.html#L466'>update-cursor</a> <a href='../081print.mu.html#L4'>screen</a>, recipes, current-sandbox, sandbox-in-focus?, env <span id="L133" class="LineNr">133 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> <span class="Constant">+next-event</span> <span id="L134" class="LineNr">134 </span> <span class="Delimiter">}</span> @@ -208,7 +208,7 @@ if ('onhashchange' in window) { <span id="L146" class="LineNr">146 </span> assert first-sandbox, <span class="Constant">[!!]</span> <span id="L147" class="LineNr">147 </span> sandbox-left-margin:num <span class="Special"><-</span> get *first-sandbox, <span class="Constant">left:offset</span> <span id="L148" class="LineNr">148 </span> sandbox-right-margin:num <span class="Special"><-</span> get *first-sandbox, <span class="Constant">right:offset</span> -<span id="L149" class="LineNr">149 </span> _, _, copy-button-left:num, copy-button-right:num, _ <span class="Special"><-</span> <a href='005-sandbox.mu.html#L338'>sandbox-menu-columns</a> sandbox-left-margin, sandbox-right-margin +<span id="L149" class="LineNr">149 </span> _, _, copy-button-left:num, copy-button-right:num <span class="Special"><-</span> <a href='005-sandbox.mu.html#L340'>sandbox-menu-columns</a> sandbox-left-margin, sandbox-right-margin <span id="L150" class="LineNr">150 </span> copy-button-vertical-area?:bool <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L209'>within-range?</a> click-column, copy-button-left, copy-button-right <span id="L151" class="LineNr">151 </span> <span class="muControl">return-unless</span> copy-button-vertical-area?, <span class="Constant">0/false</span> <span id="L152" class="LineNr">152 </span> <span class="Comment"># finally, is sandbox editor empty?</span> @@ -293,7 +293,7 @@ if ('onhashchange' in window) { <span id="L231" class="LineNr">231 </span> <span class="Conceal">¦</span><span class="Constant"> . run (F4) .</span> <span id="L232" class="LineNr">232 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎ .</span> <span id="L233" class="LineNr">233 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────.</span> -<span id="L234" class="LineNr">234 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy delete .</span> +<span id="L234" class="LineNr">234 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy to recipe delete .</span> <span id="L235" class="LineNr">235 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎add 1, 1 .</span> <span id="L236" class="LineNr">236 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎2 .</span> <span id="L237" class="LineNr">237 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> @@ -313,7 +313,7 @@ if ('onhashchange' in window) { <span id="L251" class="LineNr">251 </span> <span class="Conceal">¦</span><span class="Constant"> . run (F4) .</span> <span id="L252" class="LineNr">252 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 .</span> <span id="L253" class="LineNr">253 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────.</span> -<span id="L254" class="LineNr">254 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy delete .</span> +<span id="L254" class="LineNr">254 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy to recipe delete .</span> <span id="L255" class="LineNr">255 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎add 1, 1 .</span> <span id="L256" class="LineNr">256 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎2 .</span> <span id="L257" class="LineNr">257 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> @@ -330,13 +330,127 @@ if ('onhashchange' in window) { <span id="L268" class="LineNr">268 </span> <span class="Conceal">¦</span><span class="Constant"> . run (F4) .</span> <span id="L269" class="LineNr">269 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎01 .</span> <span id="L270" class="LineNr">270 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────.</span> -<span id="L271" class="LineNr">271 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy delete .</span> +<span id="L271" class="LineNr">271 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy to recipe delete .</span> <span id="L272" class="LineNr">272 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎add 1, 1 .</span> <span id="L273" class="LineNr">273 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎2 .</span> <span id="L274" class="LineNr">274 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> <span id="L275" class="LineNr">275 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎ .</span> <span id="L276" class="LineNr">276 </span> ] <span id="L277" class="LineNr">277 </span>] +<span id="L278" class="LineNr">278 </span> +<span id="L279" class="LineNr">279 </span><span class="SalientComment">## the 'to recipe' button makes it easy to create a function out of a sandbox</span> +<span id="L280" class="LineNr">280 </span> +<span id="L281" class="LineNr">281 </span><span class="muScenario">scenario</span> copy-a-sandbox-to-recipe-side [ +<span id="L282" class="LineNr">282 </span> <span class="Constant">local-scope</span> +<span id="L283" class="LineNr">283 </span> trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> +<span id="L284" class="LineNr">284 </span> assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span> +<span id="L285" class="LineNr">285 </span> <span class="Comment"># empty recipes</span> +<span id="L286" class="LineNr">286 </span> assume-resources [ +<span id="L287" class="LineNr">287 </span> ] +<span id="L288" class="LineNr">288 </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#L4'>screen</a>, <span class="Constant">[add 1, 1]</span> <span class="Comment"># contents of sandbox editor</span> +<span id="L289" class="LineNr">289 </span> <span class="Comment"># run it</span> +<span id="L290" class="LineNr">290 </span> assume-console [ +<span id="L291" class="LineNr">291 </span> <span class="Conceal">¦</span> press F4 +<span id="L292" class="LineNr">292 </span> ] +<span id="L293" class="LineNr">293 </span> <a href='004-programming-environment.mu.html#L39'>event-loop</a> <a href='../081print.mu.html#L4'>screen</a>, <a href='../084console.mu.html#L23'>console</a>, env, <a href='../088file.mu.html#L11'>resources</a> +<span id="L294" class="LineNr">294 </span> screen-should-contain [ +<span id="L295" class="LineNr">295 </span> <span class="Conceal">¦</span><span class="Constant"> . run (F4) .</span> +<span id="L296" class="LineNr">296 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎ .</span> +<span id="L297" class="LineNr">297 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────.</span> +<span id="L298" class="LineNr">298 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy to recipe delete .</span> +<span id="L299" class="LineNr">299 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎add 1, 1 .</span> +<span id="L300" class="LineNr">300 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎2 .</span> +<span id="L301" class="LineNr">301 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> +<span id="L302" class="LineNr">302 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎ .</span> +<span id="L303" class="LineNr">303 </span> ] +<span id="L304" class="LineNr">304 </span> <span class="Comment"># click at left edge of 'copy' button</span> +<span id="L305" class="LineNr">305 </span> assume-console [ +<span id="L306" class="LineNr">306 </span> <span class="Conceal">¦</span> left-click<span class="Constant"> 3</span>,<span class="Constant"> 78</span> +<span id="L307" class="LineNr">307 </span> ] +<span id="L308" class="LineNr">308 </span> run [ +<span id="L309" class="LineNr">309 </span> <span class="Conceal">¦</span> <a href='004-programming-environment.mu.html#L39'>event-loop</a> <a href='../081print.mu.html#L4'>screen</a>, <a href='../084console.mu.html#L23'>console</a>, env, <a href='../088file.mu.html#L11'>resources</a> +<span id="L310" class="LineNr">310 </span> ] +<span id="L311" class="LineNr">311 </span> <span class="Comment"># it copies into recipe side</span> +<span id="L312" class="LineNr">312 </span> screen-should-contain [ +<span id="L313" class="LineNr">313 </span> <span class="Conceal">¦</span><span class="Constant"> . run (F4) .</span> +<span id="L314" class="LineNr">314 </span> <span class="Conceal">¦</span><span class="Constant"> .add 1, 1 ╎ .</span> +<span id="L315" class="LineNr">315 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> +<span id="L316" class="LineNr">316 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy to recipe delete .</span> +<span id="L317" class="LineNr">317 </span> <span class="Conceal">¦</span><span class="Constant"> .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎add 1, 1 .</span> +<span id="L318" class="LineNr">318 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎2 .</span> +<span id="L319" class="LineNr">319 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> +<span id="L320" class="LineNr">320 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎ .</span> +<span id="L321" class="LineNr">321 </span> ] +<span id="L322" class="LineNr">322 </span> <span class="Comment"># cursor should be at the top left of the recipe side</span> +<span id="L323" class="LineNr">323 </span> assume-console [ +<span id="L324" class="LineNr">324 </span> <span class="Conceal">¦</span> type <span class="Constant">[0]</span> +<span id="L325" class="LineNr">325 </span> ] +<span id="L326" class="LineNr">326 </span> run [ +<span id="L327" class="LineNr">327 </span> <span class="Conceal">¦</span> <a href='004-programming-environment.mu.html#L39'>event-loop</a> <a href='../081print.mu.html#L4'>screen</a>, <a href='../084console.mu.html#L23'>console</a>, env, <a href='../088file.mu.html#L11'>resources</a> +<span id="L328" class="LineNr">328 </span> ] +<span id="L329" class="LineNr">329 </span> screen-should-contain [ +<span id="L330" class="LineNr">330 </span> <span class="Conceal">¦</span><span class="Constant"> . run (F4) .</span> +<span id="L331" class="LineNr">331 </span> <span class="Conceal">¦</span><span class="Constant"> .0add 1, 1 ╎ .</span> +<span id="L332" class="LineNr">332 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> +<span id="L333" class="LineNr">333 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎0 edit copy to recipe delete .</span> +<span id="L334" class="LineNr">334 </span> <span class="Conceal">¦</span><span class="Constant"> .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎add 1, 1 .</span> +<span id="L335" class="LineNr">335 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎2 .</span> +<span id="L336" class="LineNr">336 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎─────────────────────────────────────────────────.</span> +<span id="L337" class="LineNr">337 </span> <span class="Conceal">¦</span><span class="Constant"> . ╎ .</span> +<span id="L338" class="LineNr">338 </span> ] +<span id="L339" class="LineNr">339 </span>] +<span id="L340" class="LineNr">340 </span> +<span id="L341" class="LineNr">341 </span><span class="muRecipe">after</span> <span class="Constant"><a href='004-programming-environment.mu.html#L81'><global-touch></a></span> [ +<span id="L342" class="LineNr">342 </span> <span class="Comment"># support 'copy to recipe' button</span> +<span id="L343" class="LineNr">343 </span> <span class="Delimiter">{</span> +<span id="L344" class="LineNr">344 </span> <span class="Conceal">¦</span> copy?:bool <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L356'>should-copy-to-recipe?</a> click-row, click-column, env +<span id="L345" class="LineNr">345 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> copy? +<span id="L346" class="LineNr">346 </span> <span class="Conceal">¦</span> modified?:bool <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L371'>prepend-sandbox-into-recipe-side</a> click-row, env +<span id="L347" class="LineNr">347 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> modified? +<span id="L348" class="LineNr">348 </span> <span class="Conceal">¦</span> put *env, <span class="Constant">sandbox-in-focus?:offset</span>, <span class="Constant">0/false</span> +<span id="L349" class="LineNr">349 </span> <span class="Conceal">¦</span> <a href='../081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='004-programming-environment.mu.html#L432'>render-recipes</a> <a href='../081print.mu.html#L4'>screen</a>, env, <a href='001-editor.mu.html#L107'>render</a> +<span id="L350" class="LineNr">350 </span> <span class="Conceal">¦</span> <a href='../081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='004-programming-environment.mu.html#L466'>update-cursor</a> <a href='../081print.mu.html#L4'>screen</a>, recipes, current-sandbox, sandbox-in-focus?, env +<span id="L351" class="LineNr">351 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> <span class="Constant">+next-event</span> +<span id="L352" class="LineNr">352 </span> <span class="Delimiter">}</span> +<span id="L353" class="LineNr">353 </span>] +<span id="L354" class="LineNr">354 </span> +<span id="L355" class="LineNr">355 </span><span class="Comment"># some preconditions for attempting to copy a sandbox into the recipe side</span> +<span id="L356" class="LineNr">356 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L356'>should-copy-to-recipe?</a> click-row:num, click-column:num, env:&:environment<span class="muRecipe"> -> </span>result:bool [ +<span id="L357" class="LineNr">357 </span> <span class="Constant">local-scope</span> +<span id="L358" class="LineNr">358 </span> <span class="Constant">load-ingredients</span> +<span id="L359" class="LineNr">359 </span> <span class="Comment"># are we below the sandbox editor?</span> +<span id="L360" class="LineNr">360 </span> click-sandbox-area?:bool <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L188'>click-on-sandbox-area?</a> click-row, click-column, env +<span id="L361" class="LineNr">361 </span> <span class="muControl">return-unless</span> click-sandbox-area?, <span class="Constant">0/false</span> +<span id="L362" class="LineNr">362 </span> <span class="Comment"># narrower, is the click in the columns spanning the 'copy' button?</span> +<span id="L363" class="LineNr">363 </span> first-sandbox:&:editor <span class="Special"><-</span> get *env, <span class="Constant">current-sandbox:offset</span> +<span id="L364" class="LineNr">364 </span> assert first-sandbox, <span class="Constant">[!!]</span> +<span id="L365" class="LineNr">365 </span> sandbox-left-margin:num <span class="Special"><-</span> get *first-sandbox, <span class="Constant">left:offset</span> +<span id="L366" class="LineNr">366 </span> sandbox-right-margin:num <span class="Special"><-</span> get *first-sandbox, <span class="Constant">right:offset</span> +<span id="L367" class="LineNr">367 </span> _, _, _, _, recipe-button-left:num, recipe-button-right:num <span class="Special"><-</span> <a href='005-sandbox.mu.html#L340'>sandbox-menu-columns</a> sandbox-left-margin, sandbox-right-margin +<span id="L368" class="LineNr">368 </span> result <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L209'>within-range?</a> click-column, recipe-button-left, recipe-button-right +<span id="L369" class="LineNr">369 </span>] +<span id="L370" class="LineNr">370 </span> +<span id="L371" class="LineNr">371 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L371'>prepend-sandbox-into-recipe-side</a> click-row:num, env:&:environment<span class="muRecipe"> -> </span>clicked-on-copy-to-recipe-button?:bool, env:&:environment [ +<span id="L372" class="LineNr">372 </span> <span class="Constant">local-scope</span> +<span id="L373" class="LineNr">373 </span> <span class="Constant">load-ingredients</span> +<span id="L374" class="LineNr">374 </span> sandbox:&:sandbox <span class="Special"><-</span> <a href='006-sandbox-copy.mu.html#L173'>find-sandbox</a> env, click-row +<span id="L375" class="LineNr">375 </span> <span class="muControl">return-unless</span> sandbox, <span class="Constant">0/false</span> +<span id="L376" class="LineNr">376 </span> recipe-editor:&:editor <span class="Special"><-</span> get *env, <span class="Constant">recipes:offset</span> +<span id="L377" class="LineNr">377 </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="L378" class="LineNr">378 </span> <span class="Comment"># make the newly inserted code easy to delineate</span> +<span id="L379" class="LineNr">379 </span> newline:char <span class="Special"><-</span> copy<span class="Constant"> 10</span> +<span id="L380" class="LineNr">380 </span> insert newline, recipe-data +<span id="L381" class="LineNr">381 </span> insert newline, recipe-data +<span id="L382" class="LineNr">382 </span> <span class="Comment"># insert code from the selected sandbox</span> +<span id="L383" class="LineNr">383 </span> sandbox-data:text <span class="Special"><-</span> get *sandbox, <span class="Constant">data:offset</span> +<span id="L384" class="LineNr">384 </span> insert recipe-data, sandbox-data +<span id="L385" class="LineNr">385 </span> <span class="Comment"># reset cursor</span> +<span id="L386" class="LineNr">386 </span> put *recipe-editor, <span class="Constant">top-of-screen:offset</span>, recipe-data +<span id="L387" class="LineNr">387 </span> put *recipe-editor, <span class="Constant">before-cursor:offset</span>, recipe-data +<span id="L388" class="LineNr">388 </span> put *recipe-editor, <span class="Constant">cursor-row:offset</span>,<span class="Constant"> 1</span> +<span id="L389" class="LineNr">389 </span> put *recipe-editor, <span class="Constant">cursor-column:offset</span>,<span class="Constant"> 0</span> +<span id="L390" class="LineNr">390 </span> <span class="muControl">return</span> <span class="Constant">1/true</span> +<span id="L391" class="LineNr">391 </span>] </pre> </body> </html> |