Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.8k
Enable disabling document-wide history tracking#10949
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Enable disabling document-wide history tracking#10949
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for making a pull request to JupyterLab! To try out this branch onbinder, follow this link: |
echarles commentedAug 30, 2021
Tests are failing. Will fix that. |
| "title":"Enable the undo/redo (`z` keystroke) on the notebook document level.", | ||
| "description":"Enable the undo/redo (`z` keystroke) on the notebook document level, so actions like cells move, change... can have history. The undo/redo never applies on the outputs, in other words, outputs don't have history.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
A general/comment-question: is thez keystroke singled out for a specific reason? I think that the document-wide undo/redo pertains bothz keystroke and theCtrl +z shortcut (/Mac equivalent).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If this works for you , and to avoid confusion with upcoming PR, I will remove mention of z/ctrl+z and will just keep the name "document-wide history"
jasongrout commentedAug 30, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Since this is a new user-facing term, I think we should have a short discussion about the name to make sure it:
It seems like we may be able to get a better term than "document-wide" - "wide" indicates scope, but also indicates a physical dimension, and to me it may not convey the idea of a combined global document structure and local edit history to everyone. Some of these alternatives are certainly worse/more confusing, but in the interest of brainstorming and maybe triggering better ideas:
|
goanpeca commentedAug 30, 2021
I like "Unified document history" |
echarles commentedAug 30, 2021
Same here with "Global document history" |
krassowski commentedAug 30, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
"Global" was my first pick too, but it is actually non-ambiguous because it could also refer to changes in multiple documents (as in PyCharm for example, after you use refactoring which changes a variable name in several documents, the undo action in any affected document will undo the change in all the changed documents). Maybe we should include the "cells" in the name? After all it changes how undo/redo works betweencells, so something like Finally, it would be good to be consistent with the find/replace which can too be either searching in all cells or only in the selected cell. I don't know if the name for document-wide search & replace was discussed earlier, but maybe it would be good to discuss it now and make both undo/redo and search/replace have consistent terminology. |
echarles commentedAug 31, 2021
CI is green. I will wait one more day for feedbacks on the nomenclature. Based on previous feedbacks, it looks like to me the one to be selected is for now |
goanpeca left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
🚀
krassowski commentedAug 31, 2021
echarles commentedAug 31, 2021
krassowski commentedAug 31, 2021
I don't think that this is the intended behaviour. I would like
Were you trying to implement this as specified above, or were we thinking about different things? |
krassowski commentedAug 31, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
To elaborate, my GIF is demonstrating thatCtrl +z affects both cells, a behaviour which was not present in 3.0 (was only introduced in 3.1) and was AFAIK the reason why we want to have option to disable document-wide tracking. |
echarles commentedAug 31, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Ok, I see. Will have a look tomorrow, and thx a lot for having looked at this closer 👍 |
echarles commentedAug 31, 2021
With |
krassowski commentedAug 31, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
No, I don't believe that this is what users (including me) want. When giving a nod to:
I meant that I agree that we should restore the 3.0 behaviour. Sorry if my response was misleading, I could have explained it better (I did not see the above sentence as contradicting restoring the 3.0 behaviour). Also, as the separation between cell undo/redo and editor undo/redo was there for many many years (in both notebook and lab), I just don't think we should remove it in a minor release. I am not saying that it should remain forever, but if we want to enable seamless migration path from Jupyter Notebook to JupyterLab (e.g. via RetroLab), we should not change this fundamental piece of UX. |
echarles commentedAug 31, 2021
So we want to keep RTC undo/redo for cell movement, right? Only the cell content should be "own-cell" like before (with the CodeMirror mecanism), or "cross-cell" (with the RTC mecanism). I will rewrite this PR to take this into account. Thx for clarifying the requirements. |
echarles commentedAug 31, 2021
Also if the intent is to have undo/redo like in jlab 3.0 in a cell working in RTC case, we would need to go to multiple undomanager as highlighted on#10791 (comment) My understanding is that having it work like in jupyerlab 3.0 does not imply RTC, this is why I have written Can anyone confirm this assumption? |
jasongrout commentedAug 31, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I thought from our discussion last Wednesday that we were going to provide a setting that reverted to the 3.0 undo behavior, but using the yjs undo mechanism (and multiple undo managers for yjs). Otherwise, as Kevin pointed out, the undo would be pretty finicky with RTC (i.e., undoing an edit in a cell would undo other people's edits, rather than just your own). And in this case, the cell-level "undo" would actually just be a new revert of the specific change, rather than an unwinding of the undo stack? |
echarles commentedAug 31, 2021
This is a much bigger implementation than having the simple fallback to code mirror. I don't know how many RTC are in the fields, and how many would want to disable the document-wide undo/redo. It is also a bit hard for me to imagine the code change to support one undi/redo manager per cell. eg., for now, you just call "redo()" method without parameters. I don't see how the shared model implementation could know which undo/redo manager to use. We would even need to change the codemirror and codeeditor api. Please correct me if I am wrong. This is why as middle-approach, I was thinking/proposing the fallback to codemirror undo/redo. |
krassowski commentedAug 31, 2021
Did anyone save minutes from last weeks discussion?
I guess we may need to modify the API indeed, but as long as we are expanding API in backward-compatible way, that should be ok, as we are aiming for this one to go into 3.2, right? |
hbcarlos commentedSep 1, 2021
The idea is to have an Instead of using the document
@echarles, I can work on this if you prefer. |
echarles commentedSep 1, 2021
Thx@hbcarlos for the pointers. I had started something in that direction. I keep you updated on my progress. |
ellisonbg commentedSep 1, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
A point that I brought up in the weekly dev meeting:
Based on this, I think there are two things that need to be named:
|
fcollonval commentedOct 2, 2021
Yes the i18n check is failing as this PR is introducing new translatable strings in the settings schema. |
echarles commentedOct 4, 2021
What is the action to take to fix that? Not sure here after readinghttps://jupyterlab.readthedocs.io/en/latest/developer/internationalization.html. Do I need to open something onhttps://github.com/jupyterlab/language-packs? |
krassowski commentedOct 4, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I think that no action is needed (this check is just to warn us about changes), but it highlights that this PR is not targeting master branch - it would have not failed on master. |
fcollonval commentedOct 4, 2021
Yep we can merge this one. The i18n check could be further improve to check that there is not yet a final release on X.Y.Z. But this is gonna be tricky to achieve. |
blink1073 commentedOct 4, 2021
It could check the current version with |
blink1073 commentedOct 4, 2021
@meeseeksdev please backport to 3.2.x |
Can't Dooooo.... It seem like this is already backported (commit is empty).I won't do anything. MrMeeseeks out. |
echarles commentedOct 4, 2021
Thx@blink1073 for the merge of this experimental feature. This PR was for 3.2 branch. I guess meeseeksdev can backport to master. |
blink1073 commentedOct 4, 2021
@meeseeksdev please backport to master |
blink1073 commentedOct 4, 2021
Thanks again@echarles! |
jasongrout commentedOct 4, 2021
Does merging this close#10791? |
jasongrout commentedOct 4, 2021
Thank you so much for working on this! It does seem a lot better to help users transition from the 3.0 behavior. I noticed a few things:
|
echarles commentedOct 5, 2021
echarles commentedOct 5, 2021
Thank you for testing@jasongrout
This is not ideal, but indeed, you loose undo capability on the moved cell. I have tried to overcome that, but was not able to add an undomanager on the clone object. I can give it another try, any further input will be helpful.
Would |
blink1073 commentedOct 5, 2021
Yes, please. I missed the fact that it was |
Co-authored-by: Eric Charles <eric@datalayer.io>
echarles commentedOct 5, 2021
@blink1073 I have openedhttps://github.com/jupyterlab/jupyterlab/pull/11215/files for this. |
mlucool commentedOct 7, 2021
@adpatter FWIW what you wrote feels more like a bug than a feature. I think document wide history tracking should scroll to where the undo happens and that would mollify some concerns. Likely this was overlooked. This PR gives users the ability to revert back by the previous undo model by setting experimentalDisableDocumentWideUndoRedo. |
krassowski commentedOct 7, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Re: above, I think that this PR had a misleading title, likely due to a typo, I now changed it to avoid misunderstandings. |
echarles commentedOct 7, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@adpatter The case you have described is what we call document-wide history tracking and is the default behavior in 3.1 and 3.2. This PR allows a user to disable that behavior and roll-back to pre-3.1 where the undo is done cell by cell, and not on a document-wide level. I hope this clarifies a bit, and sorry for the misleading title. Of course, you are welcome to open a new issue to further discuss how the case you describe should be treated (e.g. with scrolling or any other option). |
meeseeksmachine commentedOct 14, 2021
This pull request has been mentioned onJupyter Community Forum. There might be relevant details there: |


References
Fixes#10791
Code changes
Adds a notebook setting
enableDocumentWideUndoRedoand propagates this value to the notebook factory and the YModel. YModel keeps track of the last value for that setting and uses in itstransactmethod.User-facing changes
New
enableDocumentWideUndoRedosetting for the Notebook.Backwards-incompatible changes
None.