aboutsummaryrefslogtreecommitdiffstats
path: root/i_events.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2023-12-26 20:20:20 +0100
committerJoe <rbo@gmx.us>2023-12-26 20:20:20 +0100
commit245627d191cd4d7f67ddbaed2a73ee6b61c481f6 (patch)
treeb9089d0bbad978de43710538647af74a14a5c111 /i_events.go
parentup (diff)
downloadhardflip-245627d191cd4d7f67ddbaed2a73ee6b61c481f6.tar.gz
hardflip-245627d191cd4d7f67ddbaed2a73ee6b61c481f6.tar.bz2
hardflip-245627d191cd4d7f67ddbaed2a73ee6b61c481f6.tar.xz
hardflip-245627d191cd4d7f67ddbaed2a73ee6b61c481f6.tar.zst
hardflip-245627d191cd4d7f67ddbaed2a73ee6b61c481f6.zip
it builds at least
Diffstat (limited to 'i_events.go')
-rw-r--r--i_events.go39
1 files changed, 20 insertions, 19 deletions
diff --git a/i_events.go b/i_events.go
index 5c5a45c..6e3bdc5 100644
--- a/i_events.go
+++ b/i_events.go
@@ -53,25 +53,24 @@ import (
)
func i_reload_data(data *HardData) {
- data.lhost, _ = c_load_data_dir(data.data_dir)
- l := data.lhost
- data.ui.sel_max = l.count()
+ data.ldirs = c_load_data_dir(data.data_dir, data.opts)
+ data.ui.sel_max, data.ui.count_dirs, data.ui.count_hosts = i_get_sel_max(data.ldirs)
}
func i_delete_host(data *HardData) {
- ui := &data.ui
- host := data.lhost.sel(data.ui.sel)
- file_path := data.data_dir + "/" + host.Folder + host.Filename
-
- if err := os.Remove(file_path); err != nil {
- c_die("can't remove " + file_path, err)
- }
- data.lhost.del(data.ui.sel)
- data.lhost.reset_id()
- ui.sel_max = data.lhost.count()
- if ui.sel >= ui.sel_max {
- ui.sel = ui.sel_max - 1
- }
+// ui := &data.ui
+// host := data.lhost.sel(data.ui.sel)
+// file_path := data.data_dir + "/" + host.Folder + host.Filename
+//
+// if err := os.Remove(file_path); err != nil {
+// c_die("can't remove " + file_path, err)
+// }
+// data.lhost.del(data.ui.sel)
+// data.lhost.reset_id()
+// ui.sel_max = data.lhost.count()
+// if ui.sel >= ui.sel_max {
+// ui.sel = ui.sel_max - 1
+// }
}
// screen events such as keypresses
@@ -103,12 +102,14 @@ func i_events(data *HardData) {
ui.sel = 0
} else if event.Rune() == 'G' {
ui.sel = ui.sel_max - 1
- } else if event.Rune() == 'D' && data.lhost.head != nil {
+ } else if event.Rune() == 'D' &&
+ data.ldirs.head != nil &&
+ ui.sel_max != 0 {
ui.mode = DELETE_MODE
} else if event.Key() == tcell.KeyEnter {
ui.s.Fini()
- c_exec(ui.sel, data.lhost)
- if data.opts.loop == false {
+ c_exec(ui.sel, ui.sel, data.ldirs)
+ if data.opts.Loop == false {
os.Exit(0)
}
if ui.s, err = tcell.NewScreen(); err != nil {