From c5c8bfec65b9c2a80418551003f9c280dd29af29 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 19 Feb 2022 11:42:19 +0100 Subject: [PATCH] undo: switch to dive after replan / profile edit It is confusing when undoing a command and nothing happens in the UI. Therefore, switch to the corresponding dive when undoing/redoing a replan or profile edit. Signed-off-by: Berthold Stoeger --- commands/command_edit.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/commands/command_edit.cpp b/commands/command_edit.cpp index 5d835a8ee..fce031d76 100644 --- a/commands/command_edit.cpp +++ b/commands/command_edit.cpp @@ -859,6 +859,8 @@ void ReplanDive::undo() emit diveListNotifier.cylindersReset(divesToNotify); emit diveListNotifier.divesChanged(divesToNotify, DiveField::DATETIME | DiveField::DURATION | DiveField::DEPTH | DiveField::MODE | DiveField::NOTES | DiveField::SALINITY | DiveField::ATM_PRESS); + if (!placingCommand()) + setSelection({ d }, d); } // Redo and undo do the same @@ -930,6 +932,8 @@ void EditProfile::undo() QVector divesToNotify = { d }; emit diveListNotifier.divesChanged(divesToNotify, DiveField::DURATION | DiveField::DEPTH); + if (!placingCommand()) + setSelection({ d }, d); } // Redo and undo do the same