aboutsummaryrefslogtreecommitdiff
path: root/handlers.ha
diff options
context:
space:
mode:
authorJulian Hurst <ark@mansus.space>2023-09-06 21:30:18 +0200
committerJulian Hurst <ark@mansus.space>2023-09-06 21:30:18 +0200
commit26d2976281b2297d18cc803c235d759502d216d1 (patch)
treeb844f9a3d94a9cad3f84ebda9364d993b9354878 /handlers.ha
parentfd23c61da94a5e15d2cd47cb28c1654bd6fb9fd7 (diff)
downloadilhare-26d2976281b2297d18cc803c235d759502d216d1.tar.gz
Removed slices::reverse and implemented reverse function
slices module was removed from stdlib
Diffstat (limited to 'handlers.ha')
-rw-r--r--handlers.ha13
1 files changed, 11 insertions, 2 deletions
diff --git a/handlers.ha b/handlers.ha
index fb6837e..84da809 100644
--- a/handlers.ha
+++ b/handlers.ha
@@ -2,7 +2,6 @@ use libtui;
use libtui::widget;
use libtui::widget::list;
use sort;
-use slices;
use encoding::utf8;
use fmt;
use bufio;
@@ -26,6 +25,16 @@ fn globalrunehandler(ui: *libtui::ttyui, r: libtui::key) bool = {
return false;
};
+fn reverse(l: []str) void = {
+ for (let s = 0z, e = len(l) - 1; s < e) {
+ let z = l[s];
+ l[s] = l[e];
+ l[e] = z;
+ s += 1;
+ e += 1;
+ };
+};
+
fn runehandler(l: *widget::widget, r: libtui::key) bool = {
const l = l: *list::listwidget;
const r = match (r) {
@@ -158,7 +167,7 @@ fn runehandler(l: *widget::widget, r: libtui::key) bool = {
// reverse order
list::clearmarked(l);
sort::strings(l.items);
- slices::reverse(l.items: []void, size(str));
+ reverse(l.items);
case 'p' =>
strings::freeall(l.items);
list::setitems(l, itemscopy...);