aboutsummaryrefslogtreecommitdiff
path: root/handlers.ha
diff options
context:
space:
mode:
authorJulian Hurst <ark@mansus.space>2022-05-17 17:25:25 +0200
committerJulian Hurst <ark@mansus.space>2022-05-17 17:25:25 +0200
commit952ab4404ffcbb43b6a95e640c6de4fb08de5c0a (patch)
tree276cb10d071e4dcb7c7be51377d0ca325d69ea38 /handlers.ha
parent5e1a84d707b0ef7f8a80868870a7f2fc12f75a31 (diff)
downloadilhare-952ab4404ffcbb43b6a95e640c6de4fb08de5c0a.tar.gz
Move ttyui to widget
Diffstat (limited to 'handlers.ha')
-rw-r--r--handlers.ha46
1 files changed, 23 insertions, 23 deletions
diff --git a/handlers.ha b/handlers.ha
index ef374ef..41f895f 100644
--- a/handlers.ha
+++ b/handlers.ha
@@ -34,7 +34,7 @@ fn runehandler(l: *widget::widget, r: rune) bool = {
list::pageup(l);
case 'l' =>
// to print properly suspend the ui, print, then resume
- libui::suspend(&l.ui);
+ libui::suspend(&l.widget.ui);
//fmt::println(l.items[l.cursor])!;
match (list::selected(*l)) {
case let s: str =>
@@ -45,7 +45,7 @@ fn runehandler(l: *widget::widget, r: rune) bool = {
defer free(out);
fmt::println(out)!;
};
- libui::resume(&l.ui);
+ libui::resume(&l.widget.ui);
return true;
case 'g' =>
list::top(l);
@@ -65,9 +65,9 @@ fn runehandler(l: *widget::widget, r: rune) bool = {
};
case '?' =>
// TODO add commandline support maybe
- libui::suspend(&l.ui);
- fmt::fprint(l.ui.f, '?')!;
- let line = match (bufio::scanline(l.ui.f)) {
+ libui::suspend(&l.widget.ui);
+ fmt::fprint(l.widget.ui.f, '?')!;
+ let line = match (bufio::scanline(l.widget.ui.f)) {
case let s: []u8 =>
yield s;
case io::EOF =>
@@ -82,12 +82,12 @@ fn runehandler(l: *widget::widget, r: rune) bool = {
searchforward = false;
let c = l.cursor;
list::rsearch(l, searchterm);
- libui::resume(&l.ui);
+ libui::resume(&l.widget.ui);
case '/' =>
// TODO add commandline support maybe
- libui::suspend(&l.ui);
- fmt::fprint(l.ui.f, '/')!;
- let line = match (bufio::scanline(l.ui.f)) {
+ libui::suspend(&l.widget.ui);
+ fmt::fprint(l.widget.ui.f, '/')!;
+ let line = match (bufio::scanline(l.widget.ui.f)) {
case let s: []u8 =>
yield s;
case io::EOF =>
@@ -102,7 +102,7 @@ fn runehandler(l: *widget::widget, r: rune) bool = {
searchforward = true;
let c = l.cursor;
list::search(l, searchterm);
- libui::resume(&l.ui);
+ libui::resume(&l.widget.ui);
case 'o' =>
// order
sort::strings(l.items);
@@ -114,9 +114,9 @@ fn runehandler(l: *widget::widget, r: rune) bool = {
list::setitems(l, itemscopy...);
case 's' =>
// TODO add commandline support maybe
- libui::suspend(&l.ui);
- fmt::fprint(l.ui.f, "s: ")!;
- let line = match (bufio::scanline(l.ui.f)) {
+ libui::suspend(&l.widget.ui);
+ fmt::fprint(l.widget.ui.f, "s: ")!;
+ let line = match (bufio::scanline(l.widget.ui.f)) {
case let s: []u8 =>
yield s;
case io::EOF =>
@@ -128,12 +128,12 @@ fn runehandler(l: *widget::widget, r: rune) bool = {
};
defer free(line);
list::containsmark(l, strings::fromutf8(line));
- libui::resume(&l.ui);
+ libui::resume(&l.widget.ui);
case 'S' =>
// TODO add commandline support maybe
- libui::suspend(&l.ui);
- fmt::fprint(l.ui.f, "S: ")!;
- let line = match (bufio::scanline(l.ui.f)) {
+ libui::suspend(&l.widget.ui);
+ fmt::fprint(l.widget.ui.f, "S: ")!;
+ let line = match (bufio::scanline(l.widget.ui.f)) {
case let s: []u8 =>
yield s;
case io::EOF =>
@@ -145,12 +145,12 @@ fn runehandler(l: *widget::widget, r: rune) bool = {
};
defer free(line);
list::fnmatchmark(l, strings::fromutf8(line));
- libui::resume(&l.ui);
+ libui::resume(&l.widget.ui);
case 'r' =>
// TODO add commandline support maybe
- libui::suspend(&l.ui);
- fmt::fprint(l.ui.f, "r: ")!;
- let line = match (bufio::scanline(l.ui.f)) {
+ libui::suspend(&l.widget.ui);
+ fmt::fprint(l.widget.ui.f, "r: ")!;
+ let line = match (bufio::scanline(l.widget.ui.f)) {
case let s: []u8 =>
yield s;
case io::EOF =>
@@ -168,7 +168,7 @@ fn runehandler(l: *widget::widget, r: rune) bool = {
case let e: regex::error =>
fmt::fprintln(os::stderr, regex::strerror(e))!;
};
- libui::resume(&l.ui);
+ libui::resume(&l.widget.ui);
case ' ' =>
list::tmark(l);
list::down(l);
@@ -185,7 +185,7 @@ fn runehandler(l: *widget::widget, r: rune) bool = {
};
yield;
};
- libui::clear(l.ui);
+ libui::clear(l.widget.ui);
match (list::print(l)) {
case void =>
yield;