Prevent ghost cells from changing cell focus #1827
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The bug is described in UI: Cell focus changed when removing ghost cells jlewi/foyle#316
The problem was we weren't deleting the previous ghost cells until we were ready to insert the new ghost cells. When we deleted the ghost cells this could shift the current cells up. This could lead to the active cell shifting up and losing focus. This was very confusing. It felt like the ground was changing underneath you.
This PR fixes that by deleting the ghost cells from the current compeltion as soon as you change the cell focus to a new cell. Therefore by the time you start typing the previous ghost cells have already been removed.
I think this is a much better experience.
I think the original UX was motivated in part to give you time to look at the previous ghost cells while you are still typing. I also think it might have partially been for demo purposes to give you some ghost cells to continue to look at.
In practice, I find that if I don't select a ghost cell immediately after switching cell focus I never bother to look at it. So persisting the ghost cells after switching focus wasn't adding any value.
On the other hand, the cell losing focus was super frustrating.
Fix UI: Cell focus changed when removing ghost cells jlewi/foyle#316