about summary refs log tree commit diff stats
path: root/shell/environment.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-05 11:56:13 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-05 11:56:13 -0700
commit48522591f85f272230bf628213675c41db3c08ae (patch)
tree206787680881136ca5022f4f5a4c48d31afd5b3a /shell/environment.mu
parent99523f654ffc5d183de05c56965cef5ed0c1cb4e (diff)
downloadmu-48522591f85f272230bf628213675c41db3c08ae.tar.gz
refresh edited definitions on ctrl-s
Diffstat (limited to 'shell/environment.mu')
-rw-r--r--shell/environment.mu18
1 files changed, 16 insertions, 2 deletions
diff --git a/shell/environment.mu b/shell/environment.mu
index 6f0718b1..4bf90c54 100644
--- a/shell/environment.mu
+++ b/shell/environment.mu
@@ -105,11 +105,25 @@ fn edit-environment _self: (addr environment), key: grapheme, data-disk: (addr d
     #
     return
   }
-  # ctrl-s: always send to repl
+  # ctrl-s: send multiple places
   {
     compare key, 0x13/ctrl-s
     break-if-!=
-    edit-sandbox sandbox, key, globals, data-disk, 1/tweak-real-screen
+    {
+      # cursor in function modal? do nothing
+      var cursor-in-function-modal-a/eax: (addr boolean) <- get self, cursor-in-function-modal?
+      compare *cursor-in-function-modal-a, 0/false
+      break-if-!=
+      {
+        # cursor in globals? update current definition
+        var cursor-in-globals-a/edx: (addr boolean) <- get self, cursor-in-globals?
+        compare *cursor-in-globals-a, 0/false
+        break-if-=
+        edit-globals globals, key
+      }
+      # update sandbox whether the cursor is in globals or sandbox
+      edit-sandbox sandbox, key, globals, data-disk, 1/tweak-real-screen
+    }
     return
   }
   # ctrl-g: go to a function (or the repl)