From 63513e9fdb400ee9319640ab6c3d03058a20df61 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 21 Mar 2017 08:44:22 -0700 Subject: 3806 --- html/edit/001-editor.mu.html | 115 +++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 60 deletions(-) (limited to 'html') diff --git a/html/edit/001-editor.mu.html b/html/edit/001-editor.mu.html index 71290495..48044ef8 100644 --- a/html/edit/001-editor.mu.html +++ b/html/edit/001-editor.mu.html @@ -476,66 +476,61 @@ if ('onhashchange' in window) { 413 ¦ starting-comment?:bool <- equal c, 35/# 414 ¦ break-unless starting-comment? 415 ¦ trace 90, [app], [switch color back to blue] -416 ¦ color <- copy 12/lightblue -417 ¦ jump +exit -418 } -419 # if color is blue and next character is newline, switch color to white -420 { -421 ¦ color-is-blue?:bool <- equal color, 12/lightblue -422 ¦ break-unless color-is-blue? -423 ¦ ending-comment?:bool <- equal c, 10/newline -424 ¦ break-unless ending-comment? -425 ¦ trace 90, [app], [switch color back to white] -426 ¦ color <- copy 7/white -427 ¦ jump +exit -428 } -429 # if color is white (no comments) and next character is '<', switch color to red -430 { -431 ¦ break-unless color-is-white? -432 ¦ starting-assignment?:bool <- equal c, 60/< -433 ¦ break-unless starting-assignment? -434 ¦ color <- copy 1/red -435 ¦ jump +exit -436 } -437 # if color is red and next character is space, switch color to white -438 { -439 ¦ color-is-red?:bool <- equal color, 1/red -440 ¦ break-unless color-is-red? -441 ¦ ending-assignment?:bool <- equal c, 32/space -442 ¦ break-unless ending-assignment? -443 ¦ color <- copy 7/white -444 ¦ jump +exit -445 } -446 # otherwise no change -447 +exit -448 return color -449 ] -450 -451 scenario render-colors-assignment [ -452 local-scope -453 assume-screen 8/width, 5/height -454 s:text <- new [abc -455 d <- e -456 f] -457 e:&:editor <- new-editor s, 0/left, 8/right -458 run [ -459 ¦ render screen, e -460 ] -461 screen-should-contain [ -462 ¦ . . -463 ¦ .abc . -464 ¦ .d <- e . -465 ¦ .f . -466 ¦ . . -467 ] -468 screen-should-contain-in-color 1/red, [ -469 ¦ . . -470 ¦ . . -471 ¦ . <- . -472 ¦ . . -473 ¦ . . -474 ] -475 ] +416 ¦ return 12/lightblue +417 } +418 # if color is blue and next character is newline, switch color to white +419 { +420 ¦ color-is-blue?:bool <- equal color, 12/lightblue +421 ¦ break-unless color-is-blue? +422 ¦ ending-comment?:bool <- equal c, 10/newline +423 ¦ break-unless ending-comment? +424 ¦ trace 90, [app], [switch color back to white] +425 ¦ return 7/white +426 } +427 # if color is white (no comments) and next character is '<', switch color to red +428 { +429 ¦ break-unless color-is-white? +430 ¦ starting-assignment?:bool <- equal c, 60/< +431 ¦ break-unless starting-assignment? +432 ¦ return 1/red +433 } +434 # if color is red and next character is space, switch color to white +435 { +436 ¦ color-is-red?:bool <- equal color, 1/red +437 ¦ break-unless color-is-red? +438 ¦ ending-assignment?:bool <- equal c, 32/space +439 ¦ break-unless ending-assignment? +440 ¦ return 7/white +441 } +442 # otherwise no change +443 return color +444 ] +445 +446 scenario render-colors-assignment [ +447 local-scope +448 assume-screen 8/width, 5/height +449 s:text <- new [abc +450 d <- e +451 f] +452 e:&:editor <- new-editor s, 0/left, 8/right +453 run [ +454 ¦ render screen, e +455 ] +456 screen-should-contain [ +457 ¦ . . +458 ¦ .abc . +459 ¦ .d <- e . +460 ¦ .f . +461 ¦ . . +462 ] +463 screen-should-contain-in-color 1/red, [ +464 ¦ . . +465 ¦ . . +466 ¦ . <- . +467 ¦ . . +468 ¦ . . +469 ] +470 ] -- cgit 1.4.1-2-gfad0