about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-04 22:11:41 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-04 22:11:41 -0700
commit5a066f8ddaeb9e22891c67217642e7900c4eeb20 (patch)
tree87151d3bfd65478881701a528c03158d8b1b8c0a
parent65e414911feb9262fc2ae2ed397a157decaaf17e (diff)
downloadmu-5a066f8ddaeb9e22891c67217642e7900c4eeb20.tar.gz
start editing function definitions
-rw-r--r--shell/environment.mu2
-rw-r--r--shell/global.mu12
2 files changed, 12 insertions, 2 deletions
diff --git a/shell/environment.mu b/shell/environment.mu
index 9d624a1f..1545f0ff 100644
--- a/shell/environment.mu
+++ b/shell/environment.mu
@@ -180,7 +180,7 @@ fn edit-environment _self: (addr environment), key: grapheme, data-disk: (addr d
     var cursor-in-globals-a/eax: (addr boolean) <- get self, cursor-in-globals?
     compare *cursor-in-globals-a, 0/false
     break-if-=
-    edit-globals globals, key, data-disk
+    edit-globals globals, key
     return
   }
   edit-sandbox sandbox, key, globals, data-disk, 1/tweak-real-screen
diff --git a/shell/global.mu b/shell/global.mu
index 64f2a625..b8b05c23 100644
--- a/shell/global.mu
+++ b/shell/global.mu
@@ -218,7 +218,17 @@ fn render-globals-menu screen: (addr screen), _self: (addr global-table) {
   draw-text-rightward-from-cursor screen, " >>  ", width, 7/fg, 0xc5/bg=blue-bg
 }
 
-fn edit-globals _self: (addr global-table), key: grapheme, data-disk: (addr disk) {
+fn edit-globals _self: (addr global-table), key: grapheme {
+  var self/esi: (addr global-table) <- copy _self
+  var cursor-index-addr/ecx: (addr int) <- get self, cursor-index
+  var cursor-index/ecx: int <- copy *cursor-index-addr
+  var data-ah/eax: (addr handle array global) <- get self, data
+  var data/eax: (addr array global) <- lookup *data-ah
+  var cursor-offset/ecx: (offset global) <- compute-offset data, cursor-index
+  var curr-global/eax: (addr global) <- index data, cursor-offset
+  var curr-editor-ah/eax: (addr handle gap-buffer) <- get curr-global, input
+  var curr-editor/eax: (addr gap-buffer) <- lookup *curr-editor-ah
+  edit-gap-buffer curr-editor, key
 }
 
 fn assign-or-create-global _self: (addr global-table), name: (addr array byte), value: (handle cell), trace: (addr trace) {