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

Closed
opened 2026-01-31 03:19:22 +00:00 by claunia · 7 comments
Owner

Originally created by @nofunatall on GitHub (Feb 14, 2021).

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?

Originally created by @nofunatall on GitHub (Feb 14, 2021). 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?
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 03:19:22 +00:00
Author
Owner

@DHowett commented on GitHub (Feb 15, 2021):

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.

@DHowett commented on GitHub (Feb 15, 2021): 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.
Author
Owner

@ghost commented on GitHub (Feb 15, 2021):

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!

@ghost commented on GitHub (Feb 15, 2021): 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!
Author
Owner

@nofunatall commented on GitHub (Feb 15, 2021):

@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.

@nofunatall commented on GitHub (Feb 15, 2021): @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.
Author
Owner

@DHowett commented on GitHub (Feb 16, 2021):

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.

@DHowett commented on GitHub (Feb 16, 2021): 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.
Author
Owner

@tocker commented on GitHub (Jun 13, 2021):

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
@tocker commented on GitHub (Jun 13, 2021): 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" ``` <details><summary>Version details</summary> ``` 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 ``` </details>
Author
Owner

@smartbit commented on GitHub (Jan 20, 2023):

@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.😢

@smartbit commented on GitHub (Jan 20, 2023): @tocker regretfully `less --mouse` disables _Automatically copy selection to clipboard_ in Microsoft Terminal ![Automatically_copy_selection_to_clipboard](https://user-images.githubusercontent.com/16225624/213674061-2b968ac8-90ed-498e-855a-f82aad12ea9f.png) A workaround is [pressing SHIFT](https://unix.stackexchange.com/a/163724) which does seem to work in `tmux` too. Then you have a _workaround_ for a _workaround_.:cry:
Author
Owner

@Nantris commented on GitHub (Aug 8, 2023):

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

@Nantris commented on GitHub (Aug 8, 2023): This workaround breaks even selecting text for me. Any advice?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12581