如何在Visual Studio宏中开始文本选择

时间:2023-01-14 18:48:09

Long ago in a former editor, there was the ability to begin a macro, and then "open" the text selection...such that if your next action was to, say, search for some string - the text selection would then extend to that spot.

很久以前,在一个前编辑器中,有能力开始一个宏,然后“打开”文本选择...这样,如果你的下一个动作是,比如搜索一些字符串 - 那么文本选择将扩展到那个地方。

This was a great way to do fairly sophisticated operations without having to use wildcards or regular expressions.

这是一种很好的方法,无需使用通配符或正则表达式即可完成相当复杂的操作。

Is there a similar facility in Visual Studio 2008?

Visual Studio 2008中是否有类似的工具?

1 个解决方案

#1


Ctrl-= is the answer.

Ctrl- =就是答案。

It is the 'SelectToLastGoBack' command, officially documented as "Selects from the current location in the editor back to the previous location in the navigation history". So, get the cursor where you want to begin your selection (preferably using something reliably repeatable like a search), start a new search (usually I like ctrl-I better than ctrl-F because I can see what it's doing, but ctrl-I seems to not work right in macros), have the search end where you want to end it (esc to close search box), and hit control equals to select back to where you started.

它是'SelectToLastGoBack'命令,正式记录为“从编辑器中的当前位置选择回导航历史记录中的上一个位置”。所以,将光标放在你想要开始选择的地方(最好使用像搜索一样可靠的可重复的东西),开始一个新的搜索(通常我喜欢ctrl-I比ctrl-F更好,因为我可以看到它在做什么,但是ctrl-我似乎无法在宏中工作),搜索结束你想要结束它(esc关闭搜索框),并点击控制等于选择回到你开始的地方。

Unfortunately I can't really find anything that explains in detail how the editor decides what the previous location in navigation history is.

遗憾的是,我无法找到任何能够详细解释编辑器如何确定导航历史记录中以前位置的内容。

#1


Ctrl-= is the answer.

Ctrl- =就是答案。

It is the 'SelectToLastGoBack' command, officially documented as "Selects from the current location in the editor back to the previous location in the navigation history". So, get the cursor where you want to begin your selection (preferably using something reliably repeatable like a search), start a new search (usually I like ctrl-I better than ctrl-F because I can see what it's doing, but ctrl-I seems to not work right in macros), have the search end where you want to end it (esc to close search box), and hit control equals to select back to where you started.

它是'SelectToLastGoBack'命令,正式记录为“从编辑器中的当前位置选择回导航历史记录中的上一个位置”。所以,将光标放在你想要开始选择的地方(最好使用像搜索一样可靠的可重复的东西),开始一个新的搜索(通常我喜欢ctrl-I比ctrl-F更好,因为我可以看到它在做什么,但是ctrl-我似乎无法在宏中工作),搜索结束你想要结束它(esc关闭搜索框),并点击控制等于选择回到你开始的地方。

Unfortunately I can't really find anything that explains in detail how the editor decides what the previous location in navigation history is.

遗憾的是,我无法找到任何能够详细解释编辑器如何确定导航历史记录中以前位置的内容。