about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-10-24 19:33:41 -0700
committerKartik Agaram <vc@akkartik.com>2020-10-24 19:33:41 -0700
commita87bc353f51ddd966acb84c574b61b89ed4a9089 (patch)
tree49a9a41a18e97c130fccb5bba6fa8b55b1b72286
parente648bc9c889978522acb068570d4c87790db9ca1 (diff)
downloadmu-a87bc353f51ddd966acb84c574b61b89ed4a9089.tar.gz
.
-rw-r--r--apps/tile/environment.mu19
1 files changed, 8 insertions, 11 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu
index c60ce3b8..f8daaddd 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -423,20 +423,17 @@ $process-sandbox:body: {
       decrement-final-element cursor-call-path
       break $process-sandbox:body
     }
-    # if cursor is at end of word, insert word after
-    {
-      var at-end?/eax: boolean <- cursor-at-end? cursor-word
-      compare at-end?, 0  # false
-      break-if-=
-      append-word cursor-word-ah
-      var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
-      increment-final-element cursor-call-path
-      break $process-sandbox:body
-    }
-    # otherwise split word into two
+    # otherwise insert word after and move cursor to it for the next key
+    # (but we'll continue to track the current cursor-word for the rest of this function)
     append-word cursor-word-ah
     var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
     increment-final-element cursor-call-path
+    # if cursor is at end of word, that's all
+    var at-end?/eax: boolean <- cursor-at-end? cursor-word
+    compare at-end?, 0  # false
+    break-if-!= $process-sandbox:body
+    # otherwise we're in the middle of a word
+    # move everything after cursor to the (just created) next word
     var next-word-ah/eax: (addr handle word) <- get cursor-word, next
     var _next-word/eax: (addr word) <- lookup *next-word-ah
     var next-word/ebx: (addr word) <- copy _next-word