about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--apps/tile/data.mu13
-rw-r--r--apps/tile/environment.mu14
2 files changed, 20 insertions, 7 deletions
diff --git a/apps/tile/data.mu b/apps/tile/data.mu
index 0464c54f..9bf08502 100644
--- a/apps/tile/data.mu
+++ b/apps/tile/data.mu
@@ -619,6 +619,19 @@ fn move-final-element-to-start-of-line list: (addr handle call-path-element) {
   move-final-element-to-start-of-line list
 }
 
+fn move-final-element-to-end-of-line list: (addr handle call-path-element) {
+  var final-ah/eax: (addr handle call-path-element) <- copy list
+  var final/eax: (addr call-path-element) <- lookup *final-ah
+  var val-ah/ecx: (addr handle word) <- get final, word
+  var val/eax: (addr word) <- lookup *val-ah
+  var new-ah/edx: (addr handle word) <- get val, next
+  var target/eax: (addr word) <- lookup *new-ah
+  compare target, 0
+  break-if-=
+  copy-object new-ah, val-ah
+  move-final-element-to-end-of-line list
+}
+
 fn push-to-call-path-element list: (addr handle call-path-element), new: (addr handle word) {
   var new-element-storage: (handle call-path-element)
   var new-element-ah/edi: (addr handle call-path-element) <- address new-element-storage
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu
index 3a17bcad..64af0c3a 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -351,7 +351,7 @@ $process-sandbox:body: {
     var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
     drop-nested-calls cursor-call-path-ah
     move-final-element-to-start-of-line cursor-call-path-ah
-    # move cursor to start of initial word
+    # move cursor to start of word
     var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
     var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
     var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
@@ -363,13 +363,13 @@ $process-sandbox:body: {
   compare key, 5  # ctrl-e
   $process-sandbox:end-of-line: {
     break-if-!=
-    # move cursor to final word of sandbox
-    var cursor-call-path-ah/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path
-    initialize-path-from-sandbox sandbox, cursor-call-path-ah
+    # move cursor up past all calls and to start of line
+    var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+    drop-nested-calls cursor-call-path-ah
+    move-final-element-to-end-of-line cursor-call-path-ah
+    # move cursor to end of word
     var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
-    var dest/eax: (addr handle word) <- get cursor-call-path, word
-    final-word dest, dest
-    # move cursor to end of final word
+    var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word
     var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
     cursor-to-end cursor-word
     # this works because expanded words lie to the right of their bodies