MouseNavigation
MouseNavigation copied to clipboard
Mouse navigation does not work correctly when viewing documents side-by-side
Steps for reproducing this issue:
- Open Visual Studio.
- Open some text file.
- Open another text file.
- Arrange both windows side-by-side (e.g. the first one on the left, the second one on the right).
- Position the cursor by clicking at some text positions in the left window.
- Position the cursor by clicking at some text positions in the right window.
- Again, position the cursor by clicking at some text positions in the left window.
- Hit the back button on the mouse a couple of times.
The first couple of backnavs will work correctly. However, as soon as the cursor moves back to the right window, one will not be able to do any more backnavs. By hovering the mouse over the right window one will be able to do some more backnavs, until the cursor moves back to the left window.
This behavior differs from the behavior that Visual Studio exhibits when one uses the Navigate Backward menu button or the corresponding keyboard shortcut.
Unfortunately, this probably limits the usability of this extension for users with large monitors (which become more and more common nowadays) who are usually editing multiple documents in side-by-side view.
Hi @thomaskrowe,
Thanks for taking the time to report this, complete with steps to reproduce the issue. I agree that multiple windows side-by-side is a common scenario. In fact, I'm using that feature right now. :smile:
:thought_balloon: I haven't looked into the specifics or tested this, but my guess is clicking the mouse buttons is setting focus to the window underneath the mouse pointer, changing the meaning of "back" and/or "forward" right at the time you are trying to execute the command. It's a pretty simple extension; I'm going to mark this up for grabs in case someone else wants to find a solution before I'm able to get to it. If this turns out to be the actual cause, I'm going to guess it's also the underlying cause of #3.
I'm looking at fixing this. Before I do so, I'd like to ask the following so that I don't screw anything else up: what was the reasoning of overriding PostprocessMouseUp
versus the other handlers (PreprocessMouseUp
or PreprocessMouseDown
)?
I'm not sure. It's been in place for a long time: https://github.com/tunnelvisionlabs/LangSvcV2/commit/3d2d5acd038bc16e918566933b01b5e7597b8e9c
my guess is clicking the mouse buttons is setting focus to the window underneath the mouse pointer, changing the meaning of "back" and/or "forward" right at the time you are trying to execute the command.
That does seem to be the issue, from my investigation. The "quick" fix that I was hoping for, of changing the method that is overridden to PreprocessMouseDown
does not work 😞. It seems like VS changes focus no matter if the event is marked as handled in any of the ____Mouse____
Preprocess/Postprocess & Down/Up events.