diff options
author | Joe <rbo@gmx.us> | 2024-01-04 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-01-04 20:20:20 +0100 |
commit | c099d658545476a39855e55bca8ef9c42c9f43a3 (patch) | |
tree | e67b7805501c773d4bf34e94030d847ef3ce0376 /i_events.go | |
parent | tryna make it work (diff) | |
download | hardflip-c099d658545476a39855e55bca8ef9c42c9f43a3.tar.gz hardflip-c099d658545476a39855e55bca8ef9c42c9f43a3.tar.bz2 hardflip-c099d658545476a39855e55bca8ef9c42c9f43a3.tar.xz hardflip-c099d658545476a39855e55bca8ef9c42c9f43a3.tar.zst hardflip-c099d658545476a39855e55bca8ef9c42c9f43a3.zip |
mixed is good
Diffstat (limited to 'i_events.go')
-rw-r--r-- | i_events.go | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/i_events.go b/i_events.go index 436706d..7f585de 100644 --- a/i_events.go +++ b/i_events.go @@ -53,6 +53,7 @@ package main import ( "os" + "github.com/gdamore/tcell/v2" ) @@ -96,37 +97,38 @@ func i_events(data *HardData) { os.Exit(0) } else if event.Rune() == 'j' || event.Key() == tcell.KeyDown { - if ui.sel.line < ui.sel_max - 1 { + if ui.line < ui.sel_max - 1 { ui.inc_sel(1) } } else if event.Rune() == 'k' || event.Key() == tcell.KeyUp { - if ui.sel.line > 0 { + if ui.line > 0 { ui.inc_sel(-1) } } else if event.Rune() == 'g' { - ui.sel.line = 0 + ui.line = 0 } else if event.Rune() == 'G' { - ui.sel.line = ui.sel_max - 1 + ui.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 { - if ui.sel.host_ptr != nil { + if data.ptr != nil && data.ptr.is_dir() == false { ui.s.Fini() - c_exec(ui.sel.host_ptr) + c_exec(data.ptr.get_self_host()) if data.opts.Loop == false { os.Exit(0) + } else { + if ui.s, err = tcell.NewScreen(); err != nil { + c_die("view", err) + } + if err := ui.s.Init(); err != nil { + c_die("view", err) + } + ui.s.SetStyle(ui.def_style) } } - if ui.s, err = tcell.NewScreen(); err != nil { - c_die("view", err) - } - if err := ui.s.Init(); err != nil { - c_die("view", err) - } - ui.s.SetStyle(ui.def_style) } if event.Key() == tcell.KeyCtrlR { i_reload_data(data) |