diff options
Diffstat (limited to 'handlers.ha')
| -rw-r--r-- | handlers.ha | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/handlers.ha b/handlers.ha index dda5c51..c4f28db 100644 --- a/handlers.ha +++ b/handlers.ha @@ -47,14 +47,19 @@ fn runehandler(l: *widget::widget, r: libtui::key) bool = { // to print properly suspend the ui, print, then resume libtui::suspend(&l.widget.ui); //fmt::println(l.items[l.cursor])!; + const termchar = if (nulterm) { + yield "\0"; + } else { + yield "\n"; + }; match (list::selected(*l)) { case let s: str => - fmt::println(s)!; + fmt::printf("{}{}", s, termchar)!; case let s: []str => defer free(s); - const out = strings::join("\n", s...); + const out = strings::join(termchar, s...); defer free(out); - fmt::println(out)!; + fmt::printf("{}{}", out, termchar)!; }; libtui::resume(&l.widget.ui); return true; @@ -222,14 +227,19 @@ fn runehandler(l: *widget::widget, r: libtui::key) bool = { // to print properly suspend the ui, print, then resume libtui::suspend(&l.widget.ui); //fmt::println(l.items[l.cursor])!; + const termchar = if (nulterm) { + yield "\0"; + } else { + yield "\n"; + }; match (list::selected(*l)) { case let s: str => - fmt::println(s)!; + fmt::printf("{}{}", s, termchar)!; case let s: []str => defer free(s); - const out = strings::join("\n", s...); + const out = strings::join(termchar, s...); defer free(out); - fmt::println(out)!; + fmt::printf("{}{}", out, termchar)!; }; libtui::resume(&l.widget.ui); return true; |
