Using the Undo and Redo Stack


Keyboard:  CTRL + Z (undo); ALT + BACKSPACE (undo); CTRL + SHIFT + Z (redo); ALT + SHIFT + BACKSPACE (redo); CTRL + Y (redo)
Menu:  Edit -> Undo; Edit -> Redo
Command:  Edit.Undo; Edit.Redo
Versions:  2008,2010
Published:  4/11/2010
Code:  vstipEdit0045

Download the seriously cool Tip of the Day Extension to get the daily tips delivered to your Start Page!


We all know about the famous Undo and Redo actions.  And we have all used CTRL + Z at one point or another to fix a mistake.  BUT did you know you don't have to press CTRL + Z a billion times to go back to a particular action?  The Undo and Redo stack is readily available for you to use for quick, large scale, Undo or Redo operations.

It's easy to use.  Just locate the Undo and Redo section of the toolbar:

image

Next, click on the drop down arrow for the action you want to perform.  In this case, I'll look at the Undo stack:

image

By default, it will only undo the last action HOWEVER notice what happens when I put my mouse over the actions:

image

It will automatically select multiple actions to Undo or Redo.  Also notice it shows you at the bottom how many actions you are about to Undo.  Once you have all the actions selected you want then just click the Left Mouse button.  That's pretty much it.  Go forth and do some Undo and Redo actions!

Comments (4)

  1. Anders Borum says:

    Hi,

    I always use the combination of CTRL+Z for undo and CTRL+SHIFT+Z for redo; as far as I can remember it’s been the preferred key combination for most of the devs I’ve worked with, and I fail to see why you’d want to introduce the CTRL+Y for redo – it’s an ackward combination – especially for a single hand chord.

  2. zainnab says:

    Anders! 🙂

    Excellent point and it turns out I missed a whole pair of key combos that were available as well.  Thanks for the catch I’ve updated the post based on your feedback.

    Z

  3. I agree with Anders, what's up with CTRL+Y?  What happened to the standard CTRL+SHIFT+Z for redo?  Also, I can't find how to tell the IDE how many steps to remember for Undo and Redo?  It looks like it's only remembering the past 2 steps.  I need it to remember more, like everything since I loaded the page in the IDE

  4. mellamokb says:

    Maybe some of us minor peons who DO use CTRL+Y could have a say.

    1) It isn't awkward, not when you're used to it.  It's easy to denigrate anything that isn't "your way".  I personally think CTRL+SHIFT+Z is a stupid choice and confusing because it's too close in keystrokes and so easy to get unintentionally backwards.

    2) Literally thousands of programs use CTRL+Y for redo, and it has been the standard in Microsoft products for 15+ years.

    3) Let's consider for a moment the consequences.  You are a user that is used to CTRL+Y being line yank but it's redo.  You press CTRL+Y.  Nothing happens.  You then try the next obvious choice (yes there are MORE THAN ONE) CTRL+X, and go on your merry way.  Now flip scenario.  You area  user that is used to CTRL+Y being redo but it's line yank.  You press CTRL+Y after undoing a bunch of things.  Then you find to your chagrin that a line is removed.  Confused, you press it again and again only to fine more lines removed from your source code.  Once you've recovered those lines, you realize that your entire redo stack is gone.  Now you have to painstakingly remember what you had just undone, and if you're lucky, you can just re-load the file to get it back.

    So which is the safer approach?  You decide!

    ~ mellamokb

Skip to main content