aboutsummaryrefslogtreecommitdiffstats
path: root/i_events.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2023-12-27 20:20:20 +0100
committerJoe <rbo@gmx.us>2023-12-27 20:20:20 +0100
commitd1e2afc6e969fc647394959f03ae0b867385d1a1 (patch)
tree6c3a81a10b34f05f1fb558eb6481bd5a46c76283 /i_events.go
parentnotmuch (diff)
downloadhardflip-d1e2afc6e969fc647394959f03ae0b867385d1a1.tar.gz
hardflip-d1e2afc6e969fc647394959f03ae0b867385d1a1.tar.bz2
hardflip-d1e2afc6e969fc647394959f03ae0b867385d1a1.tar.xz
hardflip-d1e2afc6e969fc647394959f03ae0b867385d1a1.tar.zst
hardflip-d1e2afc6e969fc647394959f03ae0b867385d1a1.zip
aint easy
Diffstat (limited to 'i_events.go')
-rw-r--r--i_events.go28
1 files changed, 16 insertions, 12 deletions
diff --git a/i_events.go b/i_events.go
index 6e3bdc5..7937f7e 100644
--- a/i_events.go
+++ b/i_events.go
@@ -39,7 +39,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* hardflip: src/i_events.go
- * Thu Dec 21 12:49:09 2023
+ * Wed Dec 27 17:56:44 2023
* Joe
*
* events in the code
@@ -54,7 +54,9 @@ import (
func i_reload_data(data *HardData) {
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)
+ data.ui.sel_max,
+ data.ui.count_dirs,
+ data.ui.count_hosts = i_get_sel_max(data.ldirs)
}
func i_delete_host(data *HardData) {
@@ -90,27 +92,29 @@ func i_events(data *HardData) {
os.Exit(0)
} else if event.Rune() == 'j' ||
event.Key() == tcell.KeyDown {
- if ui.sel < ui.sel_max - 1 {
- ui.sel += 1
+ if ui.sel.line < ui.sel_max - 1 {
+ ui.inc_sel(1)
}
} else if event.Rune() == 'k' ||
event.Key() == tcell.KeyUp {
- if ui.sel > 0 {
- ui.sel -= 1
+ if ui.sel.line > 0 {
+ ui.inc_sel(-1)
}
} else if event.Rune() == 'g' {
- ui.sel = 0
+ ui.sel.line = 0
} else if event.Rune() == 'G' {
- ui.sel = ui.sel_max - 1
+ ui.sel.line = ui.sel_max - 1
} 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, ui.sel, data.ldirs)
- if data.opts.Loop == false {
- os.Exit(0)
+ if ui.sel.host_ptr != nil {
+ ui.s.Fini()
+ c_exec(ui.sel.host_ptr)
+ if data.opts.Loop == false {
+ os.Exit(0)
+ }
}
if ui.s, err = tcell.NewScreen(); err != nil {
c_die("view", err)