mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 18:43:54 -06:00
Fix overwrite key binding warning in the SUI (#17763)
Fixes a regression from the actions MVVM change in #14292 - attempting to overwrite a keybinding was displaying a warning but propagating the change before the user acknowledged it. The overwrite key binding warning in the SUI works like before Closes #17754
This commit is contained in:
parent
fd1b1c35b4
commit
ce92b18507
@ -278,11 +278,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
// Check for this special case:
|
// Check for this special case:
|
||||||
// we're changing the key chord,
|
// we're changing the key chord,
|
||||||
// but the new key chord is already in use
|
// but the new key chord is already in use
|
||||||
|
bool conflictFound{ false };
|
||||||
if (isNewAction || args.OldKeys().Modifiers() != args.NewKeys().Modifiers() || args.OldKeys().Vkey() != args.NewKeys().Vkey())
|
if (isNewAction || args.OldKeys().Modifiers() != args.NewKeys().Modifiers() || args.OldKeys().Vkey() != args.NewKeys().Vkey())
|
||||||
{
|
{
|
||||||
const auto& conflictingCmd{ _Settings.ActionMap().GetActionByKeyChord(args.NewKeys()) };
|
const auto& conflictingCmd{ _Settings.ActionMap().GetActionByKeyChord(args.NewKeys()) };
|
||||||
if (conflictingCmd)
|
if (conflictingCmd)
|
||||||
{
|
{
|
||||||
|
conflictFound = true;
|
||||||
// We're about to overwrite another key chord.
|
// We're about to overwrite another key chord.
|
||||||
// Display a confirmation dialog.
|
// Display a confirmation dialog.
|
||||||
TextBlock errorMessageTB{};
|
TextBlock errorMessageTB{};
|
||||||
@ -324,13 +326,18 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update settings model and view model
|
// if there was a conflict, the flyout we created will handle whether changes need to be propagated
|
||||||
applyChangesToSettingsModel();
|
// otherwise, go ahead and apply the changes
|
||||||
|
if (!conflictFound)
|
||||||
|
{
|
||||||
|
// update settings model and view model
|
||||||
|
applyChangesToSettingsModel();
|
||||||
|
|
||||||
// We NEED to toggle the edit mode here,
|
// We NEED to toggle the edit mode here,
|
||||||
// so that if nothing changed, we still exit
|
// so that if nothing changed, we still exit
|
||||||
// edit mode.
|
// edit mode.
|
||||||
senderVM.ToggleEditMode();
|
senderVM.ToggleEditMode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionsViewModel::_KeyBindingViewModelDeleteNewlyAddedKeyBindingHandler(const Editor::KeyBindingViewModel& senderVM, const IInspectable& /*args*/)
|
void ActionsViewModel::_KeyBindingViewModelDeleteNewlyAddedKeyBindingHandler(const Editor::KeyBindingViewModel& senderVM, const IInspectable& /*args*/)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user