about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-11-07 18:14:48 -0800
committerKartik Agaram <vc@akkartik.com>2020-11-07 18:23:05 -0800
commit776f1eee0b999c22edee8ef9df0dae4927b94337 (patch)
treea20558af526b137ce314e653cac5ccc2d3f936fb /apps
parentd7ad7f9753442129c60174e2275312a1477cc15e (diff)
downloadmu-776f1eee0b999c22edee8ef9df0dae4927b94337.tar.gz
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.
Diffstat (limited to 'apps')
-rw-r--r--apps/tile/environment.mu35
1 files changed, 35 insertions, 0 deletions
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
 #############