aboutsummaryrefslogtreecommitdiff
path: root/libui/libui.ha
diff options
context:
space:
mode:
Diffstat (limited to 'libui/libui.ha')
-rw-r--r--libui/libui.ha6
1 files changed, 4 insertions, 2 deletions
diff --git a/libui/libui.ha b/libui/libui.ha
index 6ad33d1..7e40a9d 100644
--- a/libui/libui.ha
+++ b/libui/libui.ha
@@ -26,7 +26,7 @@ export fn init() ttyui = {
fmt::fatal(tty::strerror(e));
};
if (!tty::isatty(f)) {
- fmt::fatal("/dev/tty is not a tty");
+ fmt::fatal("stream is not a tty");
};
let term = match (tty::termios_query(f)) {
case let t: tty::termios =>
@@ -74,6 +74,7 @@ export fn scan(ui: ttyui) (rune | utf8::invalid | io::EOF | io::error) = {
};
// Notify (call) the ttyui's listeners with the ttyui and r as a parameter.
+// Returns true if a listener returned true, false otherwise.
export fn notify(ui: *ttyui, r: rune) bool = {
for (let i = 0z; i < len(ui.listeners); i += 1) {
if (ui.listeners[i](ui, r)) {
@@ -110,7 +111,8 @@ export fn addlistener(ui: *ttyui, l: listener) void = {
// Print a string or rune to the ttyui.
export fn print(ui: ttyui, arg: (str | rune)) void = {
- fmt::fprintf(ui.f, "{}\r", arg)!;
+ fmt::fprint(ui.f, arg)!;
+ //fmt::fprintf(ui.f, "{}\r", arg)!;
};
// Clear the ttyui.