diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 13:25:40 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 13:25:40 -0700 |
commit | 3d8b137c879c6f5c01588c2dbbb35bc0ec028909 (patch) | |
tree | b00800b9fb00b422b3eaf5acb02f1667ad62fbc7 /sandbox/008-sandbox-edit.mu | |
parent | a0331a9b0eab63a000dcd022fe605d124c573b8d (diff) | |
download | mu-3d8b137c879c6f5c01588c2dbbb35bc0ec028909.tar.gz |
3391 - type abbreviations everywhere
Well, almost. I can't use them in some places in C++ where I'm just creating a temporary reagent without passing it through transforms. Like in some unit tests. I can't use them in memory-should-contain. And there's one remaining bug: I can't use abbreviations in a couple of places in 075channel.mu.
Diffstat (limited to 'sandbox/008-sandbox-edit.mu')
-rw-r--r-- | sandbox/008-sandbox-edit.mu | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/sandbox/008-sandbox-edit.mu b/sandbox/008-sandbox-edit.mu index c92ec445..51a01b58 100644 --- a/sandbox/008-sandbox-edit.mu +++ b/sandbox/008-sandbox-edit.mu @@ -8,8 +8,8 @@ scenario clicking-on-a-sandbox-moves-it-to-editor [ assume-console [ press F4 ] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text - event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data + 2:&:programming-environment-data <- new-programming-environment screen:&:screen, 1:text + event-loop screen:&:screen, console:&:console, 2:&:programming-environment-data screen-should-contain [ . run (F4) . . . @@ -25,7 +25,7 @@ scenario clicking-on-a-sandbox-moves-it-to-editor [ left-click 3, 4 ] run [ - event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data + event-loop screen:&:screen, console:&:console, 2:&:programming-environment-data ] # it pops back into editor screen-should-contain [ @@ -39,7 +39,7 @@ scenario clicking-on-a-sandbox-moves-it-to-editor [ type [0] ] run [ - event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data + event-loop screen:&:screen, console:&:console, 2:&:programming-environment-data ] screen-should-contain [ . run (F4) . @@ -52,7 +52,7 @@ scenario clicking-on-a-sandbox-moves-it-to-editor [ after <global-touch> [ # support 'edit' button { - edit?:boolean <- should-attempt-edit? click-row, click-column, env + edit?:bool <- should-attempt-edit? click-row, click-column, env break-unless edit? edit?, env <- try-edit-sandbox click-row, env break-unless edit? @@ -65,35 +65,35 @@ after <global-touch> [ ] # some preconditions for attempting to edit a sandbox -def should-attempt-edit? click-row:number, click-column:number, env:address:programming-environment-data -> result:boolean [ +def should-attempt-edit? click-row:num, click-column:num, env:&:programming-environment-data -> result:bool [ local-scope load-ingredients # are we below the sandbox editor? - click-sandbox-area?:boolean <- click-on-sandbox-area? click-row, env + click-sandbox-area?:bool <- click-on-sandbox-area? click-row, env reply-unless click-sandbox-area?, 0/false # narrower, is the click in the columns spanning the 'edit' button? - first-sandbox:address:editor-data <- get *env, current-sandbox:offset + first-sandbox:&:editor-data <- get *env, current-sandbox:offset assert first-sandbox, [!!] - sandbox-left-margin:number <- get *first-sandbox, left:offset - sandbox-right-margin:number <- get *first-sandbox, right:offset - edit-button-left:number, edit-button-right:number, _ <- sandbox-menu-columns sandbox-left-margin, sandbox-right-margin - edit-button-vertical-area?:boolean <- within-range? click-column, edit-button-left, edit-button-right + sandbox-left-margin:num <- get *first-sandbox, left:offset + sandbox-right-margin:num <- get *first-sandbox, right:offset + edit-button-left:num, edit-button-right:num, _ <- sandbox-menu-columns sandbox-left-margin, sandbox-right-margin + edit-button-vertical-area?:bool <- within-range? click-column, edit-button-left, edit-button-right reply-unless edit-button-vertical-area?, 0/false # finally, is sandbox editor empty? - current-sandbox:address:editor-data <- get *env, current-sandbox:offset + current-sandbox:&:editor-data <- get *env, current-sandbox:offset result <- empty-editor? current-sandbox ] -def try-edit-sandbox click-row:number, env:address:programming-environment-data -> clicked-on-edit-button?:boolean, env:address:programming-environment-data [ +def try-edit-sandbox click-row:num, env:&:programming-environment-data -> clicked-on-edit-button?:bool, env:&:programming-environment-data [ local-scope load-ingredients # identify the sandbox to edit, if the click was actually on the 'edit' button - sandbox:address:sandbox-data <- find-sandbox env, click-row + sandbox:&:sandbox-data <- find-sandbox env, click-row return-unless sandbox, 0/false clicked-on-edit-button? <- copy 1/true # 'edit' button = 'copy' button + 'delete' button text:text <- get *sandbox, data:offset - current-sandbox:address:editor-data <- get *env, current-sandbox:offset + current-sandbox:&:editor-data <- get *env, current-sandbox:offset current-sandbox <- insert-text current-sandbox, text env <- delete-sandbox env, sandbox # reset scroll @@ -105,12 +105,12 @@ scenario sandbox-with-print-can-be-edited [ assume-screen 50/width, 20/height # run a print instruction 1:text <- new [print-integer screen, 4] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text + 2:&:programming-environment-data <- new-programming-environment screen:&:screen, 1:text # run the sandbox assume-console [ press F4 ] - event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data + event-loop screen:&:screen, console:&:console, 2:&:programming-environment-data screen-should-contain [ . run (F4) . . . @@ -131,7 +131,7 @@ scenario sandbox-with-print-can-be-edited [ left-click 3, 18 ] run [ - event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data + event-loop screen:&:screen, console:&:console, 2:&:programming-environment-data ] screen-should-contain [ . run (F4) . @@ -147,8 +147,8 @@ scenario editing-sandbox-after-scrolling-resets-scroll [ assume-screen 50/width, 20/height # initialize environment 1:text <- new [] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text - render-all screen, 2:address:programming-environment-data, render + 2:&:programming-environment-data <- new-programming-environment screen:&:screen, 1:text + render-all screen, 2:&:programming-environment-data, render # create 2 sandboxes and scroll to second assume-console [ press ctrl-n @@ -159,7 +159,7 @@ scenario editing-sandbox-after-scrolling-resets-scroll [ press page-down press page-down ] - event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data + event-loop screen:&:screen, console:&:console, 2:&:programming-environment-data screen-should-contain [ . run (F4) . .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. @@ -174,7 +174,7 @@ scenario editing-sandbox-after-scrolling-resets-scroll [ left-click 2, 10 ] run [ - event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data + event-loop screen:&:screen, console:&:console, 2:&:programming-environment-data ] # second sandbox shows in editor; scroll resets to display first sandbox screen-should-contain [ @@ -194,8 +194,8 @@ scenario editing-sandbox-updates-sandbox-count [ assume-screen 50/width, 20/height # initialize environment 1:text <- new [] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text - render-all screen, 2:address:programming-environment-data, render + 2:&:programming-environment-data <- new-programming-environment screen:&:screen, 1:text + render-all screen, 2:&:programming-environment-data, render # create 2 sandboxes and scroll to second assume-console [ press ctrl-n @@ -204,7 +204,7 @@ scenario editing-sandbox-updates-sandbox-count [ type [add 1, 1] press F4 ] - event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data + event-loop screen:&:screen, console:&:console, 2:&:programming-environment-data screen-should-contain [ . run (F4) . . . @@ -221,7 +221,7 @@ scenario editing-sandbox-updates-sandbox-count [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data + event-loop screen:&:screen, console:&:console, 2:&:programming-environment-data ] # no change in contents screen-should-contain [ @@ -241,7 +241,7 @@ scenario editing-sandbox-updates-sandbox-count [ press page-down ] run [ - event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data + event-loop screen:&:screen, console:&:console, 2:&:programming-environment-data ] # screen should show just final sandbox screen-should-contain [ |