about summary refs log tree commit diff stats
path: root/sandbox
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-01-21 13:51:50 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-01-22 08:52:28 -0800
commit3151fb2387439475e12a354f2905a77ccb80ca19 (patch)
treeac9d527f475ea677e3fab90b7c1c0cdcf1e2b7ca /sandbox
parentb35cdb494562feabc600a6eac2913385e507f455 (diff)
downloadmu-3151fb2387439475e12a354f2905a77ccb80ca19.tar.gz
2585 - label sandboxes with a number
It also seems useful that the number maps to the name of the file the
sandbox is saved in. However this mapping is currently a happy accident
and not actually tested.

I'm starting to switch gears and help make the editor useable with
many many sandboxes. This is just the first step of several.
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/005-sandbox.mu23
-rw-r--r--sandbox/006-sandbox-edit.mu4
-rw-r--r--sandbox/007-sandbox-delete.mu6
-rw-r--r--sandbox/009-sandbox-trace.mu10
-rw-r--r--sandbox/010-warnings.mu6
5 files changed, 29 insertions, 20 deletions
diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu
index 405dee01..2ad25dd4 100644
--- a/sandbox/005-sandbox.mu
+++ b/sandbox/005-sandbox.mu
@@ -38,7 +38,7 @@ scenario run-and-show-results [
     .                               run (F4)           .
     .                                                  .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                                 x.
+    .0                                                x.
     .divide-with-remainder 11, 3                       .
     .3                                                 .
     .2                                                 .
@@ -67,6 +67,13 @@ scenario run-and-show-results [
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
     .                                                  .
   ]
+  # sandbox title in reverse video
+  screen-should-contain-in-color 0/black, [
+    .                                                  .
+    .                                                  .
+    .                                                  .
+    .0                                                 .
+  ]
   # run another command
   assume-console [
     left-click 1, 80
@@ -81,11 +88,11 @@ scenario run-and-show-results [
     .                               run (F4)           .
     .                                                  .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                                 x.
+    .0                                                x.
     .add 2, 2                                          .
     .4                                                 .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                                 x.
+    .1                                                x.
     .divide-with-remainder 11, 3                       .
     .3                                                 .
     .2                                                 .
@@ -218,11 +225,11 @@ recipe! render-sandbox-side screen:address:shared:screen, env:address:shared:pro
   row <- add row, 1
   draw-horizontal screen, row, left, right, 9473/horizontal-double
   sandbox:address:shared:sandbox-data <- get *env, sandbox:offset
-  row, screen <- render-sandboxes screen, sandbox, left, right, row, env
+  row, screen <- render-sandboxes screen, sandbox, left, right, row, 0, env
   clear-rest-of-screen screen, row, left, left, right
 ]
 
-recipe render-sandboxes screen:address:shared:screen, sandbox:address:shared:sandbox-data, left:number, right:number, row:number -> row:number, screen:address:shared:screen, sandbox:address:shared:sandbox-data [
+recipe render-sandboxes screen:address:shared:screen, sandbox:address:shared:sandbox-data, left:number, right:number, row:number, idx:number -> row:number, screen:address:shared:screen, sandbox:address:shared:sandbox-data [
   local-scope
   load-ingredients
   env:address:shared:programming-environment-data, _/optional <- next-ingredient
@@ -233,6 +240,7 @@ recipe render-sandboxes screen:address:shared:screen, sandbox:address:shared:san
   # render sandbox menu
   row <- add row, 1
   screen <- move-cursor screen, row, left
+  print screen, idx, 0/black, 245/grey
   clear-line-delimited screen, left, right
   delete-icon:character <- copy 120/x
   print screen, delete-icon, 245/grey
@@ -269,7 +277,8 @@ recipe render-sandboxes screen:address:shared:screen, sandbox:address:shared:san
   draw-horizontal screen, row, left, right, 9473/horizontal-double
   # draw next sandbox
   next-sandbox:address:shared:sandbox-data <- get *sandbox, next-sandbox:offset
-  row, screen <- render-sandboxes screen, next-sandbox, left, right, row
+  next-idx:number <- add idx, 1
+  row, screen <- render-sandboxes screen, next-sandbox, left, right, row, next-idx, env
 ]
 
 # assumes programming environment has no sandboxes; restores them from previous session
@@ -389,7 +398,7 @@ scenario run-instruction-manages-screen-per-sandbox [
     .                               run (F4)           .
     .                                                  .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                                 x.
+    .0                                                x.
     .print-integer screen, 4                           .
     .screen:                                           .
     .  .4                             .                .
diff --git a/sandbox/006-sandbox-edit.mu b/sandbox/006-sandbox-edit.mu
index 4b4c5175..87bf3e38 100644
--- a/sandbox/006-sandbox-edit.mu
+++ b/sandbox/006-sandbox-edit.mu
@@ -14,7 +14,7 @@ scenario clicking-on-a-sandbox-moves-it-to-editor [
     .                     run (F4)           .
     .                                        .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                       x.
+    .0                                      x.
     .add 2, 2                                .
     .4                                       .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
@@ -138,7 +138,7 @@ scenario sandbox-with-print-can-be-edited [
     .                               run (F4)           .
     .                                                  .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                                 x.
+    .0                                                x.
     .print-integer screen, 4                           .
     .screen:                                           .
     .  .4                             .                .
diff --git a/sandbox/007-sandbox-delete.mu b/sandbox/007-sandbox-delete.mu
index 64843d2d..3df785f5 100644
--- a/sandbox/007-sandbox-delete.mu
+++ b/sandbox/007-sandbox-delete.mu
@@ -18,11 +18,11 @@ scenario deleting-sandboxes [
     .                               run (F4)           .
     .                                                  .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                                 x.
+    .0                                                x.
     .add 2, 2                                          .
     .4                                                 .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                                 x.
+    .1                                                x.
     .divide-with-remainder 11, 3                       .
     .3                                                 .
     .2                                                 .
@@ -40,7 +40,7 @@ scenario deleting-sandboxes [
     .                               run (F4)           .
     .                                                  .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                                 x.
+    .0                                                x.
     .add 2, 2                                          .
     .4                                                 .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
diff --git a/sandbox/009-sandbox-trace.mu b/sandbox/009-sandbox-trace.mu
index 5c9c6714..06a7cdec 100644
--- a/sandbox/009-sandbox-trace.mu
+++ b/sandbox/009-sandbox-trace.mu
@@ -14,7 +14,7 @@ scenario sandbox-click-on-code-toggles-app-trace [
     .                     run (F4)           .
     .                                        .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                       x.
+    .0                                      x.
     .stash [abc]                             .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
     .                                        .
@@ -33,7 +33,7 @@ scenario sandbox-click-on-code-toggles-app-trace [
     .                     run (F4)           .
     .␣                                       .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                       x.
+    .0                                      x.
     .stash [abc]                             .
     .abc                                     .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
@@ -62,7 +62,7 @@ scenario sandbox-click-on-code-toggles-app-trace [
     .                     run (F4)           .
     .␣                                       .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                       x.
+    .0                                      x.
     .stash [abc]                             .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
     .                                        .
@@ -84,7 +84,7 @@ add 2, 2]
     .                     run (F4)           .
     .                                        .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                       x.
+    .0                                      x.
     .stash [abc]                             .
     .add 2, 2                                .
     .4                                       .
@@ -103,7 +103,7 @@ add 2, 2]
     .                     run (F4)           .
     .                                        .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                       x.
+    .0                                      x.
     .stash [abc]                             .
     .add 2, 2                                .
     .abc                                     .
diff --git a/sandbox/010-warnings.mu b/sandbox/010-warnings.mu
index ff3a1598..16a6a92c 100644
--- a/sandbox/010-warnings.mu
+++ b/sandbox/010-warnings.mu
@@ -89,7 +89,7 @@ scenario run-instruction-and-print-warnings [
     .                               run (F4)           .
     .                                                  .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                                 x.
+    .0                                                x.
     .get 1:address:shared:point, 1:offset              .
     .first ingredient of 'get' should be a container, ↩.
     .but got 1:address:shared:point                    .
@@ -130,7 +130,7 @@ scenario run-instruction-and-print-warnings-only-once [
     .                               run (F4)           .
     .                                                  .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                                 x.
+    .0                                                x.
     .get 1234:number, foo:offset                       .
     .unknown element foo in container number           .
     .first ingredient of 'get' should be a container, ↩.
@@ -159,7 +159,7 @@ loop
     .                               run (F4)           .
     .                                                  .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
-    .                                                 x.
+    .0                                                x.
     .{                                                 .
     .loop                                              .
     .}                                                 .