about summary refs log tree commit diff stats
path: root/chessboard-cursor.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-01-25 00:09:52 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-01-25 00:09:52 -0800
commit09e2e533ed6643cc586de3d9e51c0b1cb3da2e3e (patch)
tree6c96c50c207bf9dcd08a70ea0a0ae807f9d91296 /chessboard-cursor.mu
parent5bf97dd2d18cbf97c6aa21213f903f9d7708f151 (diff)
downloadmu-09e2e533ed6643cc586de3d9e51c0b1cb3da2e3e.tar.gz
616 - buffered-stdin handles backspace
Chessboard now *almost* handles backspace perfectly.
Diffstat (limited to 'chessboard-cursor.mu')
-rw-r--r--chessboard-cursor.mu5
1 files changed, 4 insertions, 1 deletions
diff --git a/chessboard-cursor.mu b/chessboard-cursor.mu
index 2b13e8c9..e976e3ab 100644
--- a/chessboard-cursor.mu
+++ b/chessboard-cursor.mu
@@ -212,6 +212,9 @@
   ; hook up stdin
   (stdin:channel-address <- init-channel 1:literal)
   (fork-helper send-keys-to-stdin:fn nil:literal/globals nil:literal/limit nil:literal/keyboard stdin:channel-address)
+  ; buffer stdin
+  (buffered-stdin:channel-address <- init-channel 1:literal)
+  (fork-helper buffer-stdin:fn nil:literal/globals nil:literal/limit stdin:channel-address buffered-stdin:channel-address)
   { begin
     ; print any stray characters from keyboard *before* clearing screen
     (clear-screen nil:literal/terminal)
@@ -225,7 +228,7 @@
     (print-primitive-to-host (("Hit 'q' to exit." literal)))
     (cursor-to-next-line nil:literal/terminal)
     (print-primitive-to-host (("move: " literal)))
-    (m:move-address <- read-move stdin:channel-address)
+    (m:move-address <- read-move buffered-stdin:channel-address)
     (break-unless m:move-address)
     (b:board-address <- make-move b:board-address m:move-address)
     (loop)