From dfe4b4a7021c6511f5755af090608d8f938a83e9 Mon Sep 17 00:00:00 2001 From: Daniel Milde Date: Sun, 3 Jan 2021 23:14:02 +0100 Subject: [PATCH] fixed handling of keys on confirmation dialog --- cli/cli.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index e2f1269ce..ace8e3e15 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -252,14 +252,16 @@ func (ui *UI) confirmDeletion() { SetText("Are you sure you want to delete \"" + selectedFile.Name + "\""). AddButtons([]string{"yes", "no", "don't ask me again"}). SetDoneFunc(func(buttonIndex int, buttonLabel string) { + if buttonIndex == 0 || buttonIndex == 2 { + ui.deleteSelected() + } if buttonIndex == 1 { - ui.pages.HidePage("confirm") + ui.pages.RemovePage("confirm") return } else if buttonIndex == 2 { ui.askBeforeDelete = false } ui.pages.HidePage("confirm") - ui.deleteSelected() }) ui.pages.AddPage("confirm", modal, true, true) } @@ -279,6 +281,10 @@ func (ui *UI) keyPressed(key *tcell.EventKey) *tcell.EventKey { } if key.Rune() == 'h' || key.Key() == tcell.KeyLeft { + if ui.pages.HasPage("confirm") { + return key + } + if ui.currentDirPath == ui.topDirPath { return key } @@ -291,6 +297,10 @@ func (ui *UI) keyPressed(key *tcell.EventKey) *tcell.EventKey { } if key.Rune() == 'l' || key.Key() == tcell.KeyRight { + if ui.pages.HasPage("confirm") { + return key + } + row, column := ui.table.GetSelection() if ui.currentDirPath != ui.topDirPath && row == 0 { // do not select /.. return key