How to turn off cmd-Z (undo) jumping around the file to the previous cursor position.
Answered
When we use cmd-z, the IDE immediate places the cursor back to it's location before the last change was made.
It's incredibly difficult to see the change made without spending time to find where the undo action happened.
Is there any way to turn off this behavior?
Please sign in to leave a comment.
Hello,
Do I get it right that you want to execute Undo operation immediately instead of doing it twice (Undo for moving caret, then undo for undoing changes)? Could you please share an example of what you are talking about?
Thank you.
I am having the same problem, to explain this further here is a scenario:
1) A code say; 10 pages long, on page-5 it has:
AAAAAAAAAAAAA
BBBBBBBBBb
CCCCCCCCCC
2) I scroll to page-3, do a normal copy-paste, edit stuff, or any editing...
3) I scroll up to page-5, select the BBBBBBBB line and then paste XXXXXXXXXXXX to replace it.
4) As expected, page-5 would end up having:
AAAAAAAAA
XXXXXXXXX
CCCCCCCC
5) Whilst looking at page-5, Press CTRL_Z (or CMD_Z) to UNDO. For some strange reason IntelliJ jumps back to Page-3, I totally lose track of what exactly was UNDONE.
6) If I try to CTRL_Y or CMD_Y to REDO, it takes me back to page-5, but then pressing UNDO again does not show me what's been undone, just jumps to another page which is incredibly confusing and difficult to work with
------------
The question is, how can we UNDO the content of a page (Page-5 in this example) without the system jumping to another page?
Thanks
Heider
Hi Heider,
Thanks for sharing.
Unfortunately, it is not available at the moment. Please see and follow IDEA-208735.
Hi Daniil,
IDEA-208735 is about a different thing, I believe. What it describes: type some text, move cursor, press Ctrl-Z - cursor moves back, text is not undone though. Second Ctrl-Z is needed for that.
What Heider describes (and what made me find this thread): move cursor, type some text, press Ctrl-Z - text is undone and cursor immediately moves back where it was initially. I would expect the first Ctrl-Z to undo typed/changed text, cursor doesn't move anywhere. And then second Ctrl-Z moves cursor where it was initially.
As was mentioned, if this cursor jump happened not within the same viewport (window had to be scrolled to perform it), you can't see the result of your Ctrl-Z. Maybe I renamed a var, returned old name back and now I want to copy that old name in my clipboard? Sometimes it can be hard to even find the place you've just Ctrl-Zetted.
Btw, behavior in IDEA-208735 is totally fine in my opinion. If text would be undone immediately, it would create the same problem - if your cursor was jumping not from the current viewport, you wouldn't see what just changed.
Hi Skaurus,
Thanks for sharing.
Feel free to create a new ticket on our issue tracker to support this workflow as well: https://youtrack.jetbrains.com/issues/IDEA