How do Visual Studio 2012's navigation buttons

2019-07-08 07:22发布

In Visual Studio 2012's IDE, I've noticed that there are now forward and backward navigation buttons, analogous to a web browser.

Within Solution Explorer, it seems these buttons allow you to navigate back and forth between searches. See this article for more details.

However, these navigation buttons also exist in the Toolbar directly beneath the IDE's main menu. Playing with these buttons seems to control which document windows are activated, but I can't find a blog post that explains their exact behavior.

Is there a blog post or online spec that describes exactly what these navigation buttons do?

1条回答
做个烂人
2楼-- · 2019-07-08 07:33

The Navigate Forward/Backward buttons in the standard toolbar let you navigate to previous locations in your navigation stack, whether or not they are in different documents as you mentioned.

For example, you may be looking at some method "foo" which calls another method "bar" and you press F12 to see what's happening inside "bar". When you do so, the location in "foo" where your cursor was is pushed onto the navigation stack and when you press the Navigate Backward button, you are back in "foo", exactly where you left off.

Other examples of situations in which the navigation stack is added to are (from the blog post linked below):

  • Incremental search (including reverse) leaves a go-back marker at beginning of search and another one at the end.
  • A GoToLine or a Mouse-click that moves the cursor 10+ lines from current position (so 11 lines and more) drops a go-back marker at new location.
  • A destructive action (after having moved the cursor to a new location) drops a go-back marker
  • Doing a Find (Ctrl+F) drops a go-back marker at the found location
  • Opening a file drops a go-back marker wherever the cursor was on the old file, and drops another on the opened file.

Also, it's worth knowing that the buttons have keyboard shortcuts (Ctrl + -) and (Ctrl + Shift + -).

For more information, see this blog post.

查看更多
登录 后发表回答