about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-10-09 23:32:50 -0700
committerKartik Agaram <vc@akkartik.com>2020-10-09 23:32:50 -0700
commitcbd076e02c0b7049bfb87290fc93a026cc7b355d (patch)
treea9609156a4d1052bc610e3ffa1086f0d85ed7e2b
parent6e93444ff465c6e799ddf0187ca192fbe1841b11 (diff)
downloadmu-cbd076e02c0b7049bfb87290fc93a026cc7b355d.tar.gz
6984
-rw-r--r--apps/tile/environment.mu21
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu
index 2fd2ef9b..759ff70c 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -97,11 +97,16 @@ $process:body: {
         break $process:body
       }
       # otherwise, move to end of prev word
-      var prev-word-ah/eax: (addr handle word) <- get cursor-word, prev
+      var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev
       var prev-word/eax: (addr word) <- lookup *prev-word-ah
       {
         compare prev-word, 0
         break-if-=
+        copy-object prev-word-ah, cursor-word-ah
+        # Is it expanded? If so, it's a function call. Move to the rightmost
+        # word in the function's body
+          # HERE
+        # otherwise move to end of word
         cursor-to-end prev-word
         var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
         decrement-final-element cursor-call-path
@@ -161,6 +166,13 @@ $process:body: {
       }
       break $process:body
     }
+    compare key, 0xa  # enter
+    {
+      break-if-!=
+      # toggle display of subsidiary stack
+      toggle-cursor-word sandbox
+      break $process:body
+    }
     compare key, 0x7f  # del (backspace on Macs)
     {
       break-if-!=
@@ -194,13 +206,6 @@ $process:body: {
       increment-final-element cursor-call-path
       break $process:body
     }
-    compare key, 0xa  # enter
-    {
-      break-if-!=
-      # toggle display of subsidiary stack
-      toggle-cursor-word sandbox
-      break $process:body
-    }
     # otherwise insert key within current word
     var g/edx: grapheme <- copy key
     var print?/eax: boolean <- real-grapheme? key