Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix preview changes not working for new inline rename #64264

Merged
merged 1 commit into from
Sep 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,36 @@ public RenameFlyout(RenameFlyoutViewModel viewModel, IWpfTextView textView, IWpf

private void RenameFlyout_IsKeyboardFocusWithinChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (!IsKeyboardFocusWithin)
// When previewing changes, focus will be lost and put
// into a preview changes window. If we're returning back
// to this UI, reset the flag to false. Otherwise, just ignore
// this focus change. No need to cancel in that case
if (_viewModel.PreviewChangesFlag)
{
if (IsKeyboardFocused)
{
_viewModel.PreviewChangesFlag = false;
}

return;
}

if (!IsKeyboardFocused)
{
_viewModel.Cancel();
}
}

private void TextView_LostFocus(object sender, EventArgs e)
=> _viewModel.Cancel();
{
// Preview changes is happening, no need to act on focus changes.
if (_viewModel.PreviewChangesFlag)
{
return;
}

_viewModel.Cancel();
}

private void TextView_ViewPortChanged(object sender, EventArgs e)
=> PositionAdornment();
Expand Down