microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.25k stars 8.27k forks source link

While mouse over on titlebar, allow to react to Ctrl+MouseScroll human-events on to active tab. #7427

Open vini-nu opened 4 years ago

vini-nu commented 4 years ago

Description of the new feature/enhancement

Then mouse is over WindowsTerminal's titlebar, Ctrl+MouseScroll events should be handled the same way as mouse would be over inside terminal window.

I am using Windows Terminal with SSH client to connect to linux remotes. And then I open linux htop cli-utility I cannot rezoom Windows terminal.

Proposed technical implementation details (optional)

Ctrl+mouse_scroll should allow zoom-in/out currently active tab THEN mouse is over windows-terminal's titlebar's blank space.

Currently I need to exit htop to rezoom and then reenter htop.

To replicate original problem: 1) Enter powershell via WindowsTerminal. 2) Execute: $ ssh user@hostname -p 22 -i ~/.ssh/id_ed25519 $ htop 3) Try to rezoom with Ctrl+MouseScroll , you cannot. 4) Exit htop by pressing Q. 5) Now you can rezoom with Ctrl+MouseScroll in WindowsTerminal

zadjii-msft commented 4 years ago

So this one's a little tricky - htop registers for mouse events, so when you ctrl+mouse scroll in htop, that's actually sending the input to htop, not the Terminal. That's why you can't zoom in/out while htop is open - the Terminal doesn't even get a chance at that mouse event.

Typically, shift is used as a modifier to "escape" the client mouse handling, and force the Terminal to handle the mouse event instead. However, I'm not sure if that'll work with Ctrl+scroll, since ctrl+shift+scroll is already bound to "change opacity" in the Terminal.

I wonder if there's a more clever solution beyond #1553 that we could use here...

vini-nu commented 4 years ago

Then mouse is over WindowsTerminal titlebar, mouse events could be sent to WindowsTerminal specifically. Then mouse is over terminal (inside), events could be sent casually as is now.

zadjii-msft commented 4 years ago

Okay, I'm gonna tentatively say that this is a fine request. I guess we could register a mouse handler on the root of the Page, and if the mouse event isn't handled by the time that it bubbles up to the Page, then we could try tossing it back to the control to handle without VT processing.

A quirk of this will be that the TabView does handle mouse wheel events itself. It does this to scroll the list of tabs if there are too many for the width of the window. I'm not sure if it ignores them when there aren't that many tabs or not, but it's possible this will by a little janky.