about summary refs log tree commit diff stats
path: root/baremetal/shell/sandbox.mu
diff options
context:
space:
mode:
Diffstat (limited to 'baremetal/shell/sandbox.mu')
-rw-r--r--baremetal/shell/sandbox.mu21
1 files changed, 21 insertions, 0 deletions
diff --git a/baremetal/shell/sandbox.mu b/baremetal/shell/sandbox.mu
index 3e37eac9..18bc1b09 100644
--- a/baremetal/shell/sandbox.mu
+++ b/baremetal/shell/sandbox.mu
@@ -158,6 +158,27 @@ fn edit-sandbox _self: (addr sandbox), key: byte {
     edit-gap-buffer data, g
     return
   }
+  {
+    compare g, 0x15/ctrl-u
+    break-if-!=
+    # ctrl-u: cursor up
+    var cursor-in-trace?/eax: (addr boolean) <- get self, cursor-in-trace?
+    # if cursor in trace, check if we need to switch to trace
+    # if cursor in trace, send cursor to trace
+    {
+      compare cursor-in-trace?, 0/false
+      break-if-=
+      var trace-ah/eax: (addr handle trace) <- get self, trace
+      var trace/eax: (addr trace) <- lookup *trace-ah
+      edit-trace trace, g
+      return
+    }
+    # otherwise send cursor to input
+    var data-ah/eax: (addr handle gap-buffer) <- get self, data
+    var data/eax: (addr gap-buffer) <- lookup *data-ah
+    edit-gap-buffer data, g
+    return
+  }
   # default: insert character
   add-grapheme-to-sandbox self, g
 }