From b2a2dc9593bd8a06977830f228ee86bb80c6a36e Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 16 Apr 2017 15:16:22 -0700 Subject: 3825 --- html/edit/010-sandbox-trace.mu.html | 101 +++++++++++++++++------------------- 1 file changed, 49 insertions(+), 52 deletions(-) (limited to 'html/edit/010-sandbox-trace.mu.html') diff --git a/html/edit/010-sandbox-trace.mu.html b/html/edit/010-sandbox-trace.mu.html index a0aed43e..592e0a72 100644 --- a/html/edit/010-sandbox-trace.mu.html +++ b/html/edit/010-sandbox-trace.mu.html @@ -257,63 +257,60 @@ if ('onhashchange' in window) { 194 ¦ below-sandbox-editor?:bool <- greater-or-equal click-row, first-sandbox-begins 195 ¦ break-unless below-sandbox-editor? 196 ¦ # identify the sandbox whose code is being clicked on -197 ¦ sandbox:&:sandbox <- find-click-in-sandbox-code env, click-row +197 ¦ sandbox:&:sandbox <- find-click-in-sandbox-code env, click-row 198 ¦ break-unless sandbox 199 ¦ # toggle its display-trace? property 200 ¦ x:bool <- get *sandbox, display-trace?:offset 201 ¦ x <- not x 202 ¦ *sandbox <- put *sandbox, display-trace?:offset, x -203 ¦ hide-screen screen -204 ¦ screen <- render-sandbox-side screen, env, render -205 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env -206 ¦ # no change in cursor -207 ¦ show-screen screen -208 ¦ loop +next-event -209 } -210 ] -211 -212 def find-click-in-sandbox-code env:&:environment, click-row:num -> sandbox:&:sandbox [ -213 local-scope -214 load-ingredients -215 # assert click-row >= sandbox.starting-row-on-screen -216 sandbox <- get *env, sandbox:offset -217 start:num <- get *sandbox, starting-row-on-screen:offset -218 clicked-on-sandboxes?:bool <- greater-or-equal click-row, start -219 assert clicked-on-sandboxes?, [extract-sandbox called on click to sandbox editor] -220 # while click-row < sandbox.next-sandbox.starting-row-on-screen -221 { -222 ¦ next-sandbox:&:sandbox <- get *sandbox, next-sandbox:offset -223 ¦ break-unless next-sandbox -224 ¦ next-start:num <- get *next-sandbox, starting-row-on-screen:offset -225 ¦ found?:bool <- lesser-than click-row, next-start -226 ¦ break-if found? -227 ¦ sandbox <- copy next-sandbox -228 ¦ loop -229 } -230 # return sandbox if click is in its code region -231 code-ending-row:num <- get *sandbox, code-ending-row-on-screen:offset -232 click-above-response?:bool <- lesser-than click-row, code-ending-row -233 start:num <- get *sandbox, starting-row-on-screen:offset -234 click-below-menu?:bool <- greater-than click-row, start -235 click-on-sandbox-code?:bool <- and click-above-response?, click-below-menu? -236 { -237 ¦ break-if click-on-sandbox-code? -238 ¦ return 0/no-click-in-sandbox-output -239 } -240 return sandbox -241 ] -242 -243 # when rendering a sandbox, dump its trace before response/warning if display-trace? property is set -244 after <render-sandbox-results> [ -245 { -246 ¦ display-trace?:bool <- get *sandbox, display-trace?:offset -247 ¦ break-unless display-trace? -248 ¦ sandbox-trace:text <- get *sandbox, trace:offset -249 ¦ break-unless sandbox-trace # nothing to print; move on -250 ¦ row, screen <- render-text screen, sandbox-trace, left, right, 245/grey, row -251 } -252 <render-sandbox-trace-done> -253 ] +203 ¦ screen <- render-sandbox-side screen, env, render +204 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env +205 ¦ loop +next-event +206 } +207 ] +208 +209 def find-click-in-sandbox-code env:&:environment, click-row:num -> sandbox:&:sandbox [ +210 local-scope +211 load-ingredients +212 # assert click-row >= sandbox.starting-row-on-screen +213 sandbox <- get *env, sandbox:offset +214 start:num <- get *sandbox, starting-row-on-screen:offset +215 clicked-on-sandboxes?:bool <- greater-or-equal click-row, start +216 assert clicked-on-sandboxes?, [extract-sandbox called on click to sandbox editor] +217 # while click-row < sandbox.next-sandbox.starting-row-on-screen +218 { +219 ¦ next-sandbox:&:sandbox <- get *sandbox, next-sandbox:offset +220 ¦ break-unless next-sandbox +221 ¦ next-start:num <- get *next-sandbox, starting-row-on-screen:offset +222 ¦ found?:bool <- lesser-than click-row, next-start +223 ¦ break-if found? +224 ¦ sandbox <- copy next-sandbox +225 ¦ loop +226 } +227 # return sandbox if click is in its code region +228 code-ending-row:num <- get *sandbox, code-ending-row-on-screen:offset +229 click-above-response?:bool <- lesser-than click-row, code-ending-row +230 start:num <- get *sandbox, starting-row-on-screen:offset +231 click-below-menu?:bool <- greater-than click-row, start +232 click-on-sandbox-code?:bool <- and click-above-response?, click-below-menu? +233 { +234 ¦ break-if click-on-sandbox-code? +235 ¦ return 0/no-click-in-sandbox-output +236 } +237 return sandbox +238 ] +239 +240 # when rendering a sandbox, dump its trace before response/warning if display-trace? property is set +241 after <render-sandbox-results> [ +242 { +243 ¦ display-trace?:bool <- get *sandbox, display-trace?:offset +244 ¦ break-unless display-trace? +245 ¦ sandbox-trace:text <- get *sandbox, trace:offset +246 ¦ break-unless sandbox-trace # nothing to print; move on +247 ¦ row, screen <- render-text screen, sandbox-trace, left, right, 245/grey, row +248 } +249 <render-sandbox-trace-done> +250 ] -- cgit 1.4.1-2-gfad0