Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll wheel does not work in tmux in WSL #1114

Closed
pingzing opened this issue Apr 18, 2017 · 25 comments
Closed

Scroll wheel does not work in tmux in WSL #1114

pingzing opened this issue Apr 18, 2017 · 25 comments
Labels
Milestone

Comments

@pingzing
Copy link

Versions

ConEmu build: 170402-Preview x64
OS version: Windows 10, build 15063 (Creators Update RTM) x64
Used shell version: WSL, invoked as a new task via *"%windir%\system32\bash.exe -cur_console:p"
tmux version: 2.1
WSL Ubuntu version: 16.04

Problem description

When attempting to scroll a buffer in a WSL tab running tmux, instead of scrolling, the error chime plays, and either ~2 or ~3 is printed to the input buffer (depending on the direction scrolled).

Steps to reproduce

  1. Start a new WSL ConEmu tab via bash.exe -cur_console:p (or via the task listed above)
  2. Open a tmux session.
  3. Generate enough output that vertical scrolling is required.
  4. Attempt to use the mouse's scroll wheel.

Actual results

The Windows error chime plays, and the ~2 or ~3 is entered into the input buffer.

Expected results

The tmux buffer scrolls.

Interesting notes

Bizarrely, if I show the RealConsole, and attempt to scroll my tmux buffer in that window, it works just fine.

I can also confirm that scrolling works as expected in a plain old Powershell window that's running WSL.

@pingzing
Copy link
Author

pingzing commented Apr 18, 2017

Apologies, there's one extra reproduction step I forgot to mention:

3.5. In tmux, enable mouse mode with tmux set mouse.

This will enable mousewheel scrolling.

@mdeguzis
Copy link

mdeguzis commented May 18, 2017

Mouse mode indeed does not work for me either. Turning off mouse mode does not help. This behavior is more clear when you split horizontally in Tmux and attempt to scroll the top or bottom pane.

@jhgorse
Copy link

jhgorse commented Jun 16, 2017

I have tried various mouse configurations, including on the tmux side to no avail.
https://github.com/NHDaly/tmux-better-mouse-mode

I wonder what is the best way to debug the character escape sequences of a terminal emulator? In any case, onward.

@dmak
Copy link

dmak commented Oct 13, 2017

I have similar issue with ConEmu 170807, which is running Cygwin ssh via conenu-cyg-32.exe, which is running tmux v2.3, which is running mc v4.8.18. In this combination mouse does not work in mc. If started without tmux, mc works fine. Scrolling also works fine in tmux. Seems like to be a tmux or mc issue (vim works fine under tmux), but I wonder if somebody can advise how to debug the issue. I don't have WSL installed, the command-line is conemu-cyg-32.exe ssh user@host.

@hansjny
Copy link

hansjny commented May 23, 2018

I have the same issue using ConEmu with WSL and then attempting to use the mouse with vim (mouse=a). Works fine with regular cmd or powershell.

@Maximus5 Maximus5 added the ansi label May 24, 2018
@Maximus5
Copy link
Owner

How do you run WSL?

@tfriedel
Copy link

this is a dealbreaker for me. I'm running WSL with c:\Users\thomas\AppData\Local\Microsoft\WindowsApps\ubuntu.exe -cur_console:p -c fish

@Maximus5
Copy link
Owner

How many times I shall explain that using of connector is essential?

  1. Read BashOnWindows in ConEmu
  2. Download and install latest ConEmu build (180628 at the moment)
  3. Run ConEmu64.exe -basic -run {bash}

@tfriedel
Copy link

thanks, it's basically working now. however quite often an event (scroll wheel or mouse click) is missed and instead some control characters appear in the console.
like:
[<3;29;1m[<0;20;1M[<3;30;1m

@Maximus5
Copy link
Owner

I'm working on improving pty interface. Until then ConEmu does what it can at most

@XA21X
Copy link

XA21X commented Jul 31, 2018

I'm having the same issue as @tfriedel, where mouse support mostly works but occasionally (sometimes very frequently) sending unrecognised escape codes instead. For me, it only happens in tmux at the prompt with mouse mode turned on, but somehow, neovim within tmux doesn't have this problem - maybe vim filters out unrecognised escape codes whereas tmux prints/types them?

I'm using Debian with fish shell (set via chsh) in WSL launched with the following command:
set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -C~ -cur_console:pm:/mnt --distro-guid={b281fda1-fa8a-49c7-a85f-dd2cc85bec24}

@vviikk
Copy link

vviikk commented Nov 27, 2018

How many times I shall explain that using of connector is essential?

  1. Read BashOnWindows in ConEmu
  2. Download and install latest ConEmu build (180628 at the moment)
  3. Run ConEmu64.exe -basic -run {bash}

@Maximus5 - You mean 180626? Can't find 180628.

@lemon-clown
Copy link

Hey, I using the version 180626, and start wsl with the task:

set "PATH=%ConEmuBaseDirShort%\wsl" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -C~ -cur_console:pm:/mnt

The mouse scroll working well in the beginning, but when I enter the tmux, it not works anymore(util I exit the tmux) . I'm sure I've set correctly in tmux, as it works well when I run it in the ubuntu.exe

I have read BashOnWindows in ConEmu and real search the resolution hardly :(
Please forgive my poor English, thanks!

@techexo
Copy link

techexo commented Feb 20, 2019

@Maximus5 I can confirm that there is still issues on 190217 with mouse & tmux.
tmux v2.8, set -g mouse on in .tmux.conf

I launched tmux on bash (set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --log D:/Eloi/Bugs --wsl -new_console:m:"" -C~ -t bash) and did all clicks on my mouse (if I remember correctly, left, right, middle, wheel down, wheel up).

image
connector-10660-in.log
connector-10660-out.log

@Maximus5 Maximus5 added this to the 190304 milestone Mar 3, 2019
@techexo
Copy link

techexo commented Mar 4, 2019

I can confirm that this is still present on 190303. If it can help make a diagnostic, I think that the "mouse characters" begin to show when mouse clicks are not useful anymore.

For example, using two panes with tmux and mouse mode enabled, the first click in another pane changes the active pane as it should and nothing is displayed; but as soon as no real action is intended (extra or "unsupported" click), the characters appear.

Same with the wheel: if you wheel up and there is things to display, everything seems to go well, but if you just start a tmux session and try to wheel down, characters appear. If you went up and down, just the "extra wheel movements" are displayed.

@Maximus5 Maximus5 modified the milestones: 190304, 190311 Mar 10, 2019
@Maximus5
Copy link
Owner

Still can't reproduce the issue.
It may be some extra configuration of tmux on your side.
So the questions:

  • Ubuntu release?
  • Do you start WSL with default {bash} task? E.g. ConEmu64.exe -run {bash}.
  • cat ~/.tmux.conf?
  • tmux -V? How have you installed it?
  • set | grep TERM?
  • Do you work with local host or ssh somewhere?
  • What keys (exactly) do you press to get the issue?
  • Anything else? May be you have modified other dot-files what have some effect...

@techexo
Copy link

techexo commented Mar 11, 2019

Hi @Maximus5
I am using most of the time zsh on WSL Debian Testing and a custom zsh task.

For the sake of debugging, I changed it to:

  • Ubuntu release: not Ubuntu, but Debian testing on WSL
  • Default task: default {bash} task (set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -cur_console:pm:/mnt)
  • tmux 2.8 with mouse enabled. .tmux.conf hereafter (I deleted classical prefix remap and disabled all my plugins for debugging):
set -s escape-time 0
set -g base-index 1
set -g history-limit 50000
set -g display-time 4000
set -g focus-events on
set -g mouse on
  • TERM=xterm-256color in bash; TERM=screen in tmux
  • The issue is present either on localhost or ssh (all my servers are Debian though)
  • It is button of the mouse that display the issue, and there is characters appearing for all of them (right, left, mouse click, mouse wheel up and mouse wheel down).

Edit : I just figured out that the things that are written depend of the position of the mouse on the term!
So without moving the mouse at all:

  • left click triggers the apparition of 3;52;16m or 0;52;16M, 52 & 16 corresponding probably to the cursor position (column and line);
  • right click triggers 2;**;**M but also sometimes 3;**;**m (which seems weird for the latter, maybe it's due to the copy/paste mechanisms that triggers some events with right and left buttons?);
  • middle ckick triggers 1;**;**M but also sometimes 3;**;**m (copy/paste again?);
  • mouse wheel down consistently triggers 65;**;**M; mouse wheel up 64;**;**M (note that when there is something to wheel up to, it starts displaying only when the action can't be done... Like if the signal is transmitted normally but once there is nowhere to go, mouse codes are starting to be displayed);
  • I have a mouse with supplementary buttons, so I can also have codes in 35;**;**m with other buttons...

@techexo
Copy link

techexo commented Mar 11, 2019

I have absolutely no idea if it can matters, but on the Info panel:

  • on bash, I have xterm|cygwin;
  • running tmux, I have xterm|AppKeys|BrPaste|cygwin|mouse=x54. Is the mouse=x54 normal?

Edit: Could this be related to our issue? https://superuser.com/questions/417027/why-are-random-characters-inserted-into-my-tmux-session . The problem there seemed to be that the terminal didn't support "utf-8 mouse" (whatever that means)

@techexo
Copy link

techexo commented Mar 11, 2019

@Maximus5 It seems that the culprit here is the set -s escape-time 0 in .tmux.conf!

escape-time time
Set the time in milliseconds for which tmux waits after an escape is input to determine if it is part of a function or meta key sequences. The default is 500 milliseconds.

This escape-time is often set to 0 in tmux to avoid lagging with vim, but I guess here it didn't let the mouse click time to "finish"... clicking? Putting it to 20 ms seems to do the job without making vim lag too much.

@tfriedel @XA21X , would you be in the same situation here, with escape-time modified in your .tmux.conf?

@Maximus5
Copy link
Owner

ConEmu+connector do their best to push escape sequences in the input queue atomicly. But it's a byte stream, delays may come somehow

@Maximus5
Copy link
Owner

Is the mouse=x54 normal?

JFI, it's a mouse mode requested by console. Expected if requested ;)

@techexo
Copy link

techexo commented Mar 11, 2019

OK, thanks for the info. As far as I'm concerned, the issue is fixed; but maybe @tfriedel, @XA21X or @pingzing could confirm if the issue was the same for them?

@xqliang
Copy link

xqliang commented Sep 18, 2019

I am using cmder (based on ConEmu), and I fix it by checking on the option "Send mouse events to console": Win + Alt + P -> Keys & Macro -> Mouse Options, then check on "Send mouse events to console" option.

@bformet
Copy link

bformet commented Oct 9, 2019

I am using cmder (based on ConEmu), and I fix it by checking on the option "Send mouse events to console": Win + Alt + P -> Keys & Macro -> Mouse Options, then check on "Send mouse events to console" option.

This worked for me, thanks. I Had to update ConEmu manually within Cmder to make it work.

For the reference I use Cmder 1.3.12 and updated ConEmu to 190526.

@EhsanKia
Copy link

+1 I can confirm I already had the option enabled but I had to update ConEmu to Preview channel for it work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests