Skip to content

Commit

Permalink
Fix preview changes not working for new inline rename (#64264)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzngard authored Sep 26, 2022
1 parent 2a9812e commit abb9948
Showing 1 changed file with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,36 @@ private async Task DismissToolTipsAsync()

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

0 comments on commit abb9948

Please sign in to comment.