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

[SuperEditor] Avoid restoring selection upon re-focus when selected nodes were deleted (Resolves #1074) #1103

Conversation

angelosilvestre
Copy link
Collaborator

[SuperEditor] Avoid restoring selection upon re-focus when selected nodes were deleted. Resolves #1074

EditorSelectionAndFocusPolicy restores the previous selection when the editor re-gains focus. If the node at the selection base or extent was removed while the editor didn't have focus, restoring the selection causes the editor to crash, because we are applying a selection with an inexistent node.

This PR changes EditorSelectionAndFocusPolicy to check if the nodes at base and offset are still present before restoring the selection.

Copy link
Contributor

@matthew-carroll matthew-carroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SuperEditor] Don't restore selection on refocus if selection nodes disappeared from document
2 participants