about summary refs log tree commit diff stats
path: root/baremetal
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-02-14 14:41:35 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-02-14 14:41:35 -0800
commit1010b50bb86da505f8002dd142cec0a37b13b8a2 (patch)
treecddb0d8fa05f13b744ed1313c7e2665958f836ea /baremetal
parent4961a020b47d89a09ed5cbcf51ddac2b3e8bfcc2 (diff)
downloadmu-1010b50bb86da505f8002dd142cec0a37b13b8a2.tar.gz
7742 - baremetal/shell is alive
Diffstat (limited to 'baremetal')
-rw-r--r--baremetal/shell/line.mu11
1 files changed, 10 insertions, 1 deletions
diff --git a/baremetal/shell/line.mu b/baremetal/shell/line.mu
index 67901ffa..ff5cf519 100644
--- a/baremetal/shell/line.mu
+++ b/baremetal/shell/line.mu
@@ -113,6 +113,7 @@ fn render-line-with-stack screen: (addr screen), _line: (addr line), x: int, y:
       break-if-<=
       new-y <- copy curr-y
     }
+    new-x <- add 1/inter-word-spacing
     # update
     var next-word-ah/eax: (addr handle word) <- get curr-word, next
     var next-word/eax: (addr word) <- lookup *next-word-ah
@@ -169,9 +170,17 @@ fn test-render-line-with-stack-singleton {
 
 fn edit-line _self: (addr line), key: byte {
   var self/esi: (addr line) <- copy _self
-  var cursor-word-ah/eax: (addr handle word) <- get self, cursor
+  var cursor-word-ah/edx: (addr handle word) <- get self, cursor
   var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah
   var cursor-word/ecx: (addr word) <- copy _cursor-word
+  compare key, 0x20/space
+  $edit-line:space: {
+    break-if-!=
+    append-word cursor-word-ah
+    var next-word-ah/eax: (addr handle word) <- get cursor-word, next
+    copy-object next-word-ah, cursor-word-ah
+    return
+  }
   # otherwise insert key within current word
   var g/edx: grapheme <- copy key
   add-grapheme-to-word cursor-word, g