From feed1b4a97d20b30e7e04725d299c96031bbbfc9 Mon Sep 17 00:00:00 2001 From: localhorst Date: Sun, 23 Jun 2024 11:11:20 +0200 Subject: [PATCH] fix deletion of dialog --- src/tui.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tui.cpp b/src/tui.cpp index 8941c0f..9078b11 100644 --- a/src/tui.cpp +++ b/src/tui.cpp @@ -613,6 +613,7 @@ void TUI::vTruncateText(string *psText, uint16_t u16MaxLenght) void TUI::displaySelectedDrive(Drive drive, int stdscrX, int stdscrY) { struct MenuState menustate; + static bool dialogIsActive; menustate.bAbort = false; menustate.bConfirmDelete = false; menustate.bConfirmShred = false; @@ -659,15 +660,21 @@ void TUI::displaySelectedDrive(Drive drive, int stdscrX, int stdscrY) { dialog = createDialog(40, 10, ((stdscrX) - (int)(stdscrX / 3) - 7) - (int)((stdscrX / 3) + 5) / 2, (int)(stdscrY / 2) - 5, "Confirm SHRED", "Press ENTER for SHRED", "Press ESC for cancel"); wrefresh(dialog); + dialogIsActive = true; } else if (menustate.bConfirmDelete == true) { dialog = createDialog(40, 10, ((stdscrX) - (int)(stdscrX / 3) - 7) - (int)((stdscrX / 3) + 5) / 2, (int)(stdscrY / 2) - 5, "Confirm DELETE", "Press ENTER for DELETE", "Press ESC for cancel"); wrefresh(dialog); + dialogIsActive = true; } else { - delwin(dialog); + if (dialogIsActive) + { + delwin(dialog); + dialogIsActive = false; + } } } -- 2.47.1