diff options
| author | Julian Hurst <ark@mansus.space> | 2022-12-03 20:02:17 +0100 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2022-12-03 20:02:17 +0100 |
| commit | 1edfb56af19905fb30961ee8162afe8e1719b400 (patch) | |
| tree | d47603488eda49d1b401be0d5d164f56b1db9b54 /handlers.ha | |
| parent | 4fa5bdff20cfd1dcceae402377b0c38e058ff512 (diff) | |
| download | ilhare-1edfb56af19905fb30961ee8162afe8e1719b400.tar.gz | |
Handle the error from strings::fromutf8 calls
This fix just uses an error assertion operator to handle the error from strings::fromutf8
Diffstat (limited to 'handlers.ha')
| -rw-r--r-- | handlers.ha | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/handlers.ha b/handlers.ha index 2cf34e7..dda5c51 100644 --- a/handlers.ha +++ b/handlers.ha @@ -89,7 +89,7 @@ fn runehandler(l: *widget::widget, r: libtui::key) bool = { return true; }; //defer free(line); - searchterm = strings::fromutf8(line); + searchterm = strings::fromutf8(line)!; searchforward = false; let c = l.cursor; list::rsearch(l, searchterm); @@ -109,7 +109,7 @@ fn runehandler(l: *widget::widget, r: libtui::key) bool = { return true; }; //defer free(line); - searchterm = strings::fromutf8(line); + searchterm = strings::fromutf8(line)!; searchforward = true; let c = l.cursor; list::search(l, searchterm); @@ -132,7 +132,7 @@ fn runehandler(l: *widget::widget, r: libtui::key) bool = { let newitems: []str = []; defer strings::freeall(newitems); for (let i = 0z; i < len(l.items); i += 1) { - if (strings::contains(l.items[i], strings::fromutf8(line))) { + if (strings::contains(l.items[i], strings::fromutf8(line)!)) { append(newitems, l.items[i]); }; }; @@ -165,7 +165,7 @@ fn runehandler(l: *widget::widget, r: libtui::key) bool = { return true; }; defer free(line); - list::containsmark(l, strings::fromutf8(line)); + list::containsmark(l, strings::fromutf8(line)!); libtui::resume(&l.widget.ui); case 'S' => // TODO add commandline support maybe @@ -182,7 +182,7 @@ fn runehandler(l: *widget::widget, r: libtui::key) bool = { return true; }; defer free(line); - list::fnmatchmark(l, strings::fromutf8(line)); + list::fnmatchmark(l, strings::fromutf8(line)!); libtui::resume(&l.widget.ui); case 'r' => // TODO add commandline support maybe @@ -199,7 +199,7 @@ fn runehandler(l: *widget::widget, r: libtui::key) bool = { return true; }; defer free(line); - match (regex::compile(strings::fromutf8(line))) { + match (regex::compile(strings::fromutf8(line)!)) { case let re: regex::regex => list::regexmark(l, &re); regex::finish(&re); |
