visual-studio VS 2010:“查找和替换”后如何撤消?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3840989/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:31:11  来源:igfitidea点击:

VS 2010: How do you undo after "Find and replace"?

visual-studiovisual-studio-2010

提问by Trevor Boyd Smith

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?

在 VS 2010 上,我执行了“查找和替换”...我尝试执行“撤消”但是...我不能...在“查找和替换”之后有没有办法“撤消”或这只是 VS 2010 的愚蠢 [1] 限制吗?

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.)

[1] ...“愚蠢”我的意思是...可笑!有没有搞错?!VS 2010 怎么能不让你在“查找和替换”之后撤消!不妨将 VS 2010 称为“Notepad 2010”。(更新:我刚刚检查过,记事本实际上可以在“查找和替换”之后撤消……太好了。)

采纳答案by Trevor Boyd Smith

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

如果您告诉它在替换时保持文件打开,它可以;编辑 -> 撤消。

回答by ewall

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!)

另一种有时有效的策略是再次打开“查找/替换”面板,然后交换值。(但显然这并不总是有效,因为您可能会发现比讨价还价更多的东西!)

回答by zainnab

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.

如果您在“当前项目”或“整个解决方案”上使用快速替换 (CTRL + H),那么它会在更改文件时自动打开关闭的文件并将它们标记为脏的(将星号放在文件选项卡中)。撤消将撤消所有更改,因此请注意。

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.

如果我在“当前项目”、“整个解决方案”或“Visual C++ 包含目录”上执行文件中的替换(CTRL + SHIFT + H),则需要选择“在全部替换后保持打开的修改文件”。如果您没有选择该选项并单击“全部替换”,那么您将看到一个对话框(无论要进行更改的文件是否打开),您可以通过该对话框启用此选项。如果您选择它,它将打开文件并将它们标记为脏,以便您可以撤消更改。如果不选择该选项,则无法撤消更改。

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

您可以在此处查看更多信息:http: //blogs.msdn.com/b/zainnab/archive/2010/11/25/undo-quick-replace-and-replace-in-files-vstipfind0020.aspx