microsoft / terminal

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

Mouse scroll input for WSL linux apps like less, vim, nano etc. #9165

Closed nofunatall closed 3 years ago

nofunatall commented 3 years ago

If this feature doesn't already exist I would suggest the following where by default mouse scroll would scroll terminal applications and say something like Shift + Scroll would scroll the terminal window itself.

Much like the Linux terminals Guake or Gnome terminal (Or even cmder I believe) there would be detection of such running apps like vim and less where if these are open and in the foreground the terminal app knows to pass scroll input to the running app rather than scroll the window.

Currently all mouse scrolling does is scroll the Terminal window which is less then ideal when you're inside vim or less etc.

I've read the documentation on configurable options and I couldn't see anything applicable?

DHowett commented 3 years ago

This looks like a /duplicate of #381. These applications are using the most basic mouse mode, which is "when I am a fullscreen application, send mouse scroll events to me as arrow key events." WT cannot fully detect that they're fullscreen applications, so it doesn't know to send the arrow key events on scroll.

For vim, set mouse=a will enable "full" mouse mode (which supports scroll, click, select, drag, etc.). For less there is not currently a mouse mode option.

ghost commented 3 years ago

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

nofunatall commented 3 years ago

@DHowett-MSFT

This looks like a /duplicate of #381. These applications are using the most basic mouse mode, which is "when I am a fullscreen application, send mouse scroll events to me as arrow key events." WT cannot fully detect that they're fullscreen applications, so it doesn't know to send the arrow key events on scroll.

If it can't detect it like a Linux console can then add a toggle to manually input mouse scroll as up/down arrow like I mentioned e.g shift + mouse scroll Or allow people to bind that to whatever they want in settings.

DHowett commented 3 years ago

It’s more worthwhile to just fix the underlying issue :)

we do, however, have “mouse bindings” on our roadmap which would allow you to set wheel actions to send data.

tocker commented 3 years ago

FWIW, adding the --mouse argument to less works for me.

less --mouse the_file.txt

Use the following commands to enable scrolling for the whole session. (Optionally add the following to your .bashrc | .zshrc):

[[ "${LESS}" != *--mouse* ]] && export LESS="${LESS} --mouse"
Version details ``` C:\>wsl -l -v NAME STATE VERSION * Ubuntu Running 2 ``` ``` ╰─$ uname -s -r -m -p -i -o Linux 4.19.128-microsoft-standard x86_64 x86_64 x86_64 GNU/Linux ``` ``` ╰─$ lsb_release -r -c -i -d Distributor ID: Ubuntu Description: Ubuntu 20.04.2 LTS Release: 20.04 Codename: focal ```
smartbit commented 1 year ago

@tocker regretfully less --mouse disables Automatically copy selection to clipboard in Microsoft Terminal Automatically_copy_selection_to_clipboard A workaround is pressing SHIFT which does seem to work in tmux too. Then you have a workaround for a workaround.:cry:

Nantris commented 1 year ago

This workaround breaks even selecting text for me. Any advice?