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

ctrl-z clears cell output in notebook when pressed enough times #1678

Closed
ivanov opened this issue May 1, 2012 · 6 comments · Fixed by #1965
Closed

ctrl-z clears cell output in notebook when pressed enough times #1678

ivanov opened this issue May 1, 2012 · 6 comments · Fixed by #1965
Milestone

Comments

@ivanov
Copy link
Member

ivanov commented May 1, 2012

again, this may be another CodeMirror issue, but I'm not seeing it in CM demos.

Ctrl-Z works fine to undo changes made in a cell, unless you press it one too many times, which currently ends you up with a completely empty cell. I don't think this is a feature, I think it only makes sense to undo until the last save point.

I'm seeing it act the same in Chrome and Firefox under Ubuntu 10.04

@ivanov
Copy link
Member Author

ivanov commented May 1, 2012

I should, of course, mention, that Ctrl-Y is our friend here, but I'm usually too panicked that the contents of my entire cell are gone to remember that.

@fperez
Copy link
Member

fperez commented May 1, 2012

Well, I'm not sure I'd consider this a bug: it's undoing all of your history from the first thing you typed... And I do want to be able to go past the last save point, in case I saved a mistake! I sometimes hit C-s out of reflex, only to realize that I want to undo something; I don't want to be penalized by my editor for having saved...

So IMO this is 'not a bug'. Close it?

@ivanov
Copy link
Member Author

ivanov commented May 1, 2012

i agree that my suggestion about only being able to undo until the last save point isn't the best, so that's probably not the way to go.

I just feel that it's counterintuitive that when I open a notebook (say one of the example ones that we ship) and press ctrl-z in a cell that had things in there written for me, the entire contents of that cell are gone. A typical editor only does undo to the beginning of the session, not to the beginning of time. In other words, I only want to undo back the things I did, and so for the cells whose content I did not populate originally, undo should only go back to original content (but it currently goes to an empty cell).

@takluyver
Copy link
Member

I'd agree with Paul that if you load a notebook with content, you don't expect Ctrl-Z to delete what's already there. I often play around with a script in an editor, then do a poor man's revert by holding down Ctrl-Z until it's back to what I first opened.

@fperez
Copy link
Member

fperez commented May 1, 2012

ah, I didn't realize this was happening on a freshly opened notebook! I thought it only did undo if you had written the cell from zero yourself, case in which 'go back all the way to the start' would indeed be 'go back to an empty cell'.

I certainly agree that C-z deleting existing content is a bug.

ivanov added a commit to ivanov/ipython that referenced this issue Jun 15, 2012
I found another bug where switching the cell type causes the loss of all
undo history for that cell. With this commit, switching the cell type
simply resets the history
@ivanov
Copy link
Member Author

ivanov commented Jun 15, 2012

the fix @ak3n does not work quite right for new cells. For those, it only allows you to undo up to the first set of changes in that cell.

@minrk minrk closed this as completed in 172b680 Jun 15, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
I found another bug where switching the cell type causes the loss of all
undo history for that cell. With this commit, switching the cell type
simply resets the history
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
fix for ipython#1678, undo no longer clears cells

With these changes, Ctrl-Z inside of codemirror cells will only undo up to the text that was in the cell when it was loaded from JSON.

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

Successfully merging a pull request may close this issue.

4 participants