From 01b6de7bf33faf0fa81293ca40044d8c09c0f1ac Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 13 Feb 2024 20:20:20 +0100 Subject: bro is safe --- src/i_events.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/i_events.go') diff --git a/src/i_events.go b/src/i_events.go index 4a82404..38d0643 100644 --- a/src/i_events.go +++ b/src/i_events.go @@ -53,7 +53,6 @@ package main import ( "os" - "fmt" "github.com/gdamore/tcell/v2" "golang.org/x/term" @@ -297,7 +296,8 @@ func i_events(data *HardData) { event.Key() == tcell.KeyEnd { data.litems.curr = data.litems.last } else if event.Rune() == 'D' && - data.ldirs.head != nil { + data.litems.head != nil && + data.litems.curr != nil { ui.mode = DELETE_MODE } else if event.Rune() == 'l' || event.Key() == tcell.KeyEnter { @@ -330,7 +330,6 @@ func i_events(data *HardData) { case DELETE_MODE: if event.Key() == tcell.KeyEscape || event.Key() == tcell.KeyCtrlC || - event.Rune() == 'q' || event.Rune() == 'n' { ui.mode = NORMAL_MODE } else if event.Key() == tcell.KeyEnter || @@ -357,9 +356,14 @@ func i_events(data *HardData) { break } else { data.opts.GPG = data.keys[event.Rune() - 48 - 1][0] + ui.s.HideCursor() } } else { - // TODO: confirm + if event.Rune() == 'y' { + ui.mode = NORMAL_MODE + } else if event.Rune() == 'n' { + data.opts.GPG = "" + } } } -- cgit v1.2.3