about summary refs log tree commit diff stats
path: root/edit
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-05-19 09:18:03 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-19 09:18:03 -0700
commit5d53e7d0c402ac6a5a928c0de9fd168ca6750f6e (patch)
treea31b146af88b0f8f632c817d4a7fe2ebb7711ff3 /edit
parent1521e4e32f7a5ddd3629006b3e46501ed22d91a5 (diff)
downloadmu-5d53e7d0c402ac6a5a928c0de9fd168ca6750f6e.tar.gz
2976
Diffstat (limited to 'edit')
-rw-r--r--edit/005-sandbox.mu22
1 files changed, 18 insertions, 4 deletions
diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu
index c00669ea..b0b153f8 100644
--- a/edit/005-sandbox.mu
+++ b/edit/005-sandbox.mu
@@ -268,10 +268,7 @@ def render-sandboxes screen:address:screen, sandbox:address:sandbox-data, left:n
     # render sandbox menu
     row <- add row, 1
     screen <- move-cursor screen, row, left
-    print screen, idx, 240/dark-grey
-    clear-line-until screen, right
-    delete-icon:character <- copy 120/x
-    print screen, delete-icon, 245/grey
+    screen <- render-sandbox-menu screen, idx, left, right
     # save menu row so we can detect clicks to it later
     *sandbox <- put *sandbox, starting-row-on-screen:offset, row
     # render sandbox contents
@@ -313,6 +310,23 @@ def render-sandboxes screen:address:screen, sandbox:address:sandbox-data, left:n
   row, screen <- render-sandboxes screen, next-sandbox, left, right, row, render-from, next-idx
 ]
 
+def render-sandbox-menu screen:address:screen, sandbox-index:number, left:number, right:number -> screen:address:screen [
+  local-scope
+  load-ingredients
+  move-cursor-to-column screen, left
+  print screen, sandbox-index, 240/dark-grey
+  clear-line-until screen, right
+  delete-icon:character <- copy 120/x
+  print screen, delete-icon, 245/grey
+]
+
+def move-cursor-to-column screen:address:screen, column:number -> screen:address:screen [
+  local-scope
+  load-ingredients
+  row:number, _ <- cursor-position screen
+  move-cursor screen, row, column
+]
+
 # assumes programming environment has no sandboxes; restores them from previous session
 def restore-sandboxes env:address:programming-environment-data -> env:address:programming-environment-data [
   local-scope