diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-06-09 21:28:45 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-06-09 21:28:45 -0700 |
commit | a2d4e415836867967eb2b179eb825149d13aa245 (patch) | |
tree | b394c0df6be624166b58fd68be926ea8572560cb /shell/sandbox.mu | |
parent | 117229ae1708aa0e3aaab16bad34d4b6759d3fb0 (diff) | |
download | mu-a2d4e415836867967eb2b179eb825149d13aa245.tar.gz |
.
Diffstat (limited to 'shell/sandbox.mu')
-rw-r--r-- | shell/sandbox.mu | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/shell/sandbox.mu b/shell/sandbox.mu index 2b184ebc..5cc75a0f 100644 --- a/shell/sandbox.mu +++ b/shell/sandbox.mu @@ -674,7 +674,18 @@ fn run _in-ah: (addr handle gap-buffer), out: (addr stream byte), globals: (addr # if there was no error and the read-result starts with "set" or "def", save # the gap buffer in the modified global, then create a new one for the next # command. - maybe-stash-gap-buffer-to-global globals, read-result-ah, _in-ah + var stashed?/eax: boolean <- maybe-stash-gap-buffer-to-global globals, read-result-ah, _in-ah + # if necessary, initialize a new gap-buffer in 'gap' + { + compare stashed?, 0/false + break-if-= + var in-ah/edi: (addr handle gap-buffer) <- copy _in-ah + var in/eax: (addr gap-buffer) <- lookup *in-ah + var capacity/ecx: int <- gap-buffer-capacity in + allocate in-ah + var new-gap/eax: (addr gap-buffer) <- lookup *in-ah + initialize-gap-buffer new-gap, capacity + } } fn read-evaluate-and-move-to-globals _in-ah: (addr handle gap-buffer), globals: (addr global-table), definition-name: (addr stream byte) { |