From 776f1eee0b999c22edee8ef9df0dae4927b94337 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 7 Nov 2020 18:14:48 -0800 Subject: 7208 - tile: start new line Only the final line shows the stack for now. No way to move cursor back up. One bug I'm noticing: creating a screen on one line and then reusing it in a second causes operations to be performed multiple times. --- apps/tile/environment.mu | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 9bb00fbc..0cd978f3 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -272,6 +272,13 @@ $process-sandbox:body: { toggle-cursor-word sandbox break $process-sandbox:body } + compare key, 0xc # ctrl-l + $process-sandbox:new-line: { + break-if-!= + # new line in sandbox + append-line sandbox + break $process-sandbox:body + } # word-based motions compare key, 2 # ctrl-b $process-sandbox:prev-word: { @@ -890,6 +897,34 @@ $toggle-cursor-word:body: { } } +fn append-line _sandbox: (addr sandbox) { + var sandbox/esi: (addr sandbox) <- copy _sandbox + var line-ah/ecx: (addr handle line) <- get sandbox, data + { + var line/eax: (addr line) <- lookup *line-ah + var next-line-ah/edx: (addr handle line) <- get line, next + var next-line/eax: (addr line) <- lookup *next-line-ah + compare next-line, 0 + break-if-= + line-ah <- copy next-line-ah + loop + } + var line/eax: (addr line) <- lookup *line-ah + var final-line-ah/edx: (addr handle line) <- get line, next + allocate final-line-ah + var final-line/eax: (addr line) <- lookup *final-line-ah + initialize-line final-line + var final-prev/eax: (addr handle line) <- get final-line, prev + copy-object line-ah, final-prev + # clear cursor + var final-line/eax: (addr line) <- lookup *final-line-ah + var word-ah/ecx: (addr handle word) <- get final-line, data + 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 + var dest/eax: (addr handle word) <- get cursor-call-path, word + copy-object word-ah, dest +} + ############# # Visualize ############# -- cgit 1.4.1-2-gfad0