diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-06-17 00:05:38 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-06-17 00:29:22 -0700 |
commit | dd66068298b0a11f2a1f195376cba98e0c8570b5 (patch) | |
tree | 06696728fd65cdf38a2ac571943e130e9d60c333 /084console.mu | |
parent | b89b822439f47a490a1b764e14a1ed1b73059cba (diff) | |
download | mu-dd66068298b0a11f2a1f195376cba98e0c8570b5.tar.gz |
4261 - start using literals for 'true' and 'false'
They uncovered one bug: in edit/003-shortcuts.mu <scroll-down> was returning 0 for an address in one place where I thought it was returning 0 for a boolean. Now we've eliminated this bad interaction between tangling and punning literals.
Diffstat (limited to '084console.mu')
-rw-r--r-- | 084console.mu | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/084console.mu b/084console.mu index 6aee5702..bd18226a 100644 --- a/084console.mu +++ b/084console.mu @@ -44,16 +44,16 @@ def read-event console:&:console -> result:event, found?:bool, quit?:bool, conso done?:bool <- greater-or-equal current-event-index, max break-unless done? dummy:&:event <- new event:type - return *dummy, 1/found, 1/quit + return *dummy, true/found, true/quit } result <- index *buf, current-event-index current-event-index <- add current-event-index, 1 *console <- put *console, current-event-index:offset, current-event-index - return result, 1/found, 0/quit + return result, true/found, false/quit } switch # real event source is infrequent; avoid polling it too much result:event, found?:bool <- check-for-interaction - return result, found?, 0/quit + return result, found?, false/quit ] # variant of read-event for just keyboard events. Discards everything that @@ -66,8 +66,8 @@ def read-key console:&:console -> result:char, found?:bool, quit?:bool, console: return-if quit?, 0, found?, quit? return-unless found?, 0, found?, quit? c:char, converted?:bool <- maybe-convert x, text:variant - return-unless converted?, 0, 0/found, 0/quit - return c, 1/found, 0/quit + return-unless converted?, 0, false/found, false/quit + return c, true/found, false/quit ] def send-keys-to-channel console:&:console, chan:&:sink:char, screen:&:screen -> console:&:console, chan:&:sink:char, screen:&:screen [ @@ -99,6 +99,6 @@ def wait-for-event console:&:console -> console:&:console [ def has-more-events? console:&:console -> result:bool [ local-scope load-inputs - return-if console, 0/false # fake events are processed as soon as they arrive + return-if console, false # fake events are processed as soon as they arrive result <- interactions-left? ] |