views:

50

answers:

3

On VS 2010, I do a "Find and replace"... I try to do a "undo" but... I can't... is there a way to "undo" after a "find and replace" or is this just a silly[1] limitation for VS 2010?

NOTE:

Obviously you can "reload the entire file"... but that takes way too much time and breaks up the productivity and workflow.

Foot note:

[1] ... by "silly" I mean... RIDICULOUS! What the heck?! How can VS 2010 not let you undo after doing a "find and replace"! Might as well call VS 2010 "Notepad 2010". (UPDATE: I just checked and notepad can actually do undo after a "find and replace"... soo ya.)

A: 

It can, if you tell it to keep the files open while replacing; Edit -> Undo.

Zor
A: 

Another tactic that sometimes works is to open up the Find/Replace panel again, and swap the values. (But obviously this doesn't always work because you might find more than you bargained for!)

ewall
A: 

Assuming you are wanting to do a Replace All operation:

If you are using Quick Replace (CTRL + H) on “Current Project” or “Entire Solution” then it will open closed files automatically and mark them as dirty (put the asterisk in the file tab) when it changes them. An Undo will UNDO ALL CHNAGES so watch out.

If I you do a Replace in Files (CTRL + SHIFT + H) on “Current Project”, “Entire Solution”, or “Visual C++ Include Directories” then you need to select “Keep modified files open after Replace All”. If you do not select that option and click “Replace All” then you will get a dialog (regardless if the files where changes would be made are open or not) that gives you the chance to enable this option. If you do select it then it will open the files and mark them as dirty so you can Undo the changes. If you do not select the option then you cannot Undo the changes.

You can see more here: http://blogs.msdn.com/b/zainnab/archive/2010/11/25/undo-quick-replace-and-replace-in-files-vstipfind0020.aspx

zainnab