-
Notifications
You must be signed in to change notification settings - Fork 10
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
UI: Cell focus changed when removing ghost cells #316
Comments
I think another case where this happening is if you have an earlier cell running a long running commands (e.g. watching the logs). Everytime the cell output changes that will trigger ghost cell generation (at least it will with stateful/vscode-runme#1744). So if cell K is long running and you are working on cell N, then each time cell K's output changes we will create ghost cells K+1,...,K+j this could cause the cells to change which I think can move cell N up or down which I think could cause problems. |
Does this mean we end up logging a suggestion acceptance event when we delete cells? |
I think this is most pronounced when removing ghost cells that are above the newly focused cell as the deletion will shift the current cells up. So I think a quick hack be to remove ghost cells as soon as the focus changes to a new cell. |
There's a couple ways we could potentially fix this
We might need to set the focus even if we do the delete immediately upon focus change. I rarely accept suggestions if I don't accept them immediately. So that probably makes sense to do. |
* The bug is described in 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 jlewi/foyle#316
* The bug is described in 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 jlewi/foyle#316
I think when ghost cells are deleted it can affect the rendered view.
Here's what I think I'm observing.
Suppose you were editing cell K where K < N and N is the number of cells in the document.
So we generate ghost cells at position K+1 , K+2, ...
(I was testing with #285) which was generating multiple ghost cells.
I then started editing cell N+1.
I think what happens is that when we start editing cell N+1 we delete the current ghost cells (K+1, K+2, ...). This causes the cells to shift up to fill in the gaps. I think this causes problems. I think I observed the cell I was editing disappearing.
Even more confusing, since we are generating new ghost cells, N+2, N+3,... those ghost cells now appear. So to the user it looks like the cell they were editing was deleted and replaced with some ghost cells.
We should try to reproduce this in a more controlled way so we can reproduce it and test fixes.
Could we create a function to insert ghost cells at a particular location?
The text was updated successfully, but these errors were encountered: