about summary refs log tree commit diff stats
path: root/prototypes/tile/10.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-16 18:54:12 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-16 18:54:12 -0700
commite403d15732e62fc9f1940ef14dc3b46bb11f5201 (patch)
tree81e8d387fe26be18f986fece6766c69c8ad57a2e /prototypes/tile/10.mu
parent797c93e054d210a6d595f0b57fd3d9adb9669d8c (diff)
downloadmu-e403d15732e62fc9f1940ef14dc3b46bb11f5201.tar.gz
6794 - cleaner interface for keyboard
So far I've been assuming that read-key only works for ascii, and that
I'd need to get more sophisticated both for multi-byte utf-8 and multi-byte
terminal escape codes like arrow keys. Rather to my surprise, both work
fine. We just need to adjust the types to reflect this fact.
Diffstat (limited to 'prototypes/tile/10.mu')
-rw-r--r--prototypes/tile/10.mu6
1 files changed, 3 insertions, 3 deletions
diff --git a/prototypes/tile/10.mu b/prototypes/tile/10.mu
index 73ce73ff..6f971b1c 100644
--- a/prototypes/tile/10.mu
+++ b/prototypes/tile/10.mu
@@ -63,14 +63,14 @@ fn interactive -> exit-status/ebx: int {
 $main:loop: {
     # process key
     {
-      var c/eax: byte <- read-key
+      var c/eax: grapheme <- read-key-from-real-keyboard
       compare c, 4  # ctrl-d
       break-if-= $main:loop
       process c, root, cursor
     }
     # render tree
     var _root-addr/eax: (addr cell) <- lookup root-handle
-    var root-addr/ecx: (addr cell) <- copy _root-addr
+    root-addr <- copy _root-addr
     var cursor-addr/eax: (addr cell) <- lookup *cursor
     render root-addr, cursor-addr
     loop
@@ -84,7 +84,7 @@ $main:loop: {
 # Tree mutations
 #######################################################
 
-fn process c: byte, root: (addr handle cell), cursor: (addr handle cell) {
+fn process c: grapheme, root: (addr handle cell), cursor: (addr handle cell) {
 $process:body: {
   # if c == 'h' move cursor to its parent if possible
   {