about summary refs log tree commit diff stats
path: root/apps/tile/environment.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-10-11 00:23:35 -0700
committerKartik Agaram <vc@akkartik.com>2020-10-11 00:23:35 -0700
commit9cbb6dce5400aa2218daa6408f544d99fde6c614 (patch)
tree4fe6fe30a78ec4524834a024f93b5bd367da2cbe /apps/tile/environment.mu
parent8c0d0c84647f8e91fa4dd666e9f3d462e9af5ea2 (diff)
downloadmu-9cbb6dce5400aa2218daa6408f544d99fde6c614.tar.gz
7002 - tile: next-word
Diffstat (limited to 'apps/tile/environment.mu')
-rw-r--r--apps/tile/environment.mu34
1 files changed, 34 insertions, 0 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu
index 51adfdd8..643cd13f 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -202,6 +202,11 @@ $process:body: {
           compare curr-word-is-expanded?, 0  # false
           break-if-=
           push-to-call-path-element cursor-call-path, 0
+          # position cursor at left
+          var functions/eax: (addr handle function) <- get self, functions
+          get-cursor-word sandbox, functions, cursor-word-ah
+          var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
+          cursor-to-start cursor-word
 #?           print-string 0, "d\n"
           break $process:body
         }
@@ -252,6 +257,35 @@ $process:body: {
         break $process:body
       }
     }
+    compare key, 0xe  # 14 = ctrl-n
+    $process:next-word: {
+      break-if-!=
+      print-string 0, "AA\n"
+      # jump to previous word at same level
+      var next-word-ah/edx: (addr handle word) <- get cursor-word, next
+      var next-word/eax: (addr word) <- lookup *next-word-ah
+      {
+        compare next-word, 0
+        break-if-=
+        print-string 0, "BB\n"
+        copy-object next-word-ah, cursor-word-ah
+        cursor-to-end next-word
+        var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
+        increment-final-element cursor-call-path
+        break $process:body
+      }
+      # if next word doesn't exist, try to bump up one level
+      print-string 0, "CC\n"
+      var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path
+      var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah
+      var caller-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next
+      var caller-cursor-element/eax: (addr call-path-element) <- lookup *caller-cursor-element-ah
+      compare caller-cursor-element, 0
+      break-if-=
+      print-string 0, "DD\n"
+      copy-object caller-cursor-element-ah, cursor-call-path-ah
+      break $process:body
+    }
     # if cursor is within a call, disable editing hotkeys below
     var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
     var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah