From e403d15732e62fc9f1940ef14dc3b46bb11f5201 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Wed, 16 Sep 2020 18:54:12 -0700 Subject: 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. --- prototypes/tile/5.mu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prototypes/tile/5.mu') diff --git a/prototypes/tile/5.mu b/prototypes/tile/5.mu index a49c4922..58d94636 100644 --- a/prototypes/tile/5.mu +++ b/prototypes/tile/5.mu @@ -31,7 +31,7 @@ fn main -> 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 @@ -50,7 +50,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) { var c1/eax: (addr handle cell) <- copy cursor var c2/eax: (addr cell) <- lookup *c1 create-child c2 -- cgit 1.4.1-2-gfad0