Xterm.js: Always send mousemove data

Created on 14 Oct 2017  路  13Comments  路  Source: xtermjs/xterm.js

Xterm.js only outputs mousemove data during a mouse click. I understand that's a decent default, but could it be possible to add it as an option to make xterm always output the mousemove data?

Btw: I didn't directly find any information in the docs about how to enable mouse support, but setting normalMouse and mouseEvents on the terminal object fixed that.

Details

  • Browser and browser version: Firefox 57
  • OS version: Ubuntu 17.04
  • xterm.js version: 2.9.2
help wanted typenhancement

Most helpful comment

Looks like other terminals implement this and it's documented here so this would be a nice to have. Opening it up for PRs, I'm don't think we would want a (api) setting to drive this but rather when we see CSI ? 1003 h turn it on.

I found this which is relevant to the implementation: https://www.bountysource.com/issues/41567993-mouse-mode-1003-is-unlike-xterm

All 13 comments

@skerit the terminal application (eg. tmux) is the thing that sets mouse events.

What's the purpose for wanting to send mousemove data? Is this covered by http://invisible-island.net/xterm/ctlseqs/ctlseqs.html ?

Yes, I believe it's the SET_ANY_EVENT_MOUSE event (CSI ? 1003 h)

Here's an example of it being used in an application I wrote using blessed under gnome-terminal:

node-elric-hover

AFAIK if the application supports mouse pointer integration, the mouse coordinates are sent all the time while moving the mouse. See #998 that demonstrates this pretty well. On the other hand, I may have to check the code, maybe they are only sent between mousedown -> mouseup...

At least this comment confirms what is stated above:
https://github.com/sourcelair/xterm.js/blob/v3/src/InputHandler.ts#L881

Perhaps what @skerit's app is sending is not the exact format we're expecting or something?

In version 2.9.2 I'm only seeing 2 event listeners being added for mousemove:

One in Terminal.ts, being added in response to a mousedown event:
https://github.com/sourcelair/xterm.js/blob/2e8410da4bf4ccc44b7277ec22a0d473565c9d13/src/Terminal.ts#L939-L960

And one in the SelectionManager.ts file, also in response to a mousedown event:
https://github.com/sourcelair/xterm.js/blob/3c2614ade72ea5f80624ef834524bb9afc54c97b/src/SelectionManager.ts#L363-L365

So xterm.js is just not listening for mousemove events, until a mousedown event happens.

I see a new file has been added last month, MouseZoneManager.ts, that does seem to listen to mousemove all the time:
https://github.com/sourcelair/xterm.js/blob/5bf81934cd48cbdfca55108393972a89b0a3de44/src/input/MouseZoneManager.ts#L80

Would that fix this issue, or is it meant for something else?

If we enable constant mousemove data, can we have an option to disable it? I can see this being traffic-heavy for applications not using xterm for applications that require live pointer integration.

MouseZoneManager only listens when there are links in the viewport.

Here is the code that listens to mousemove:

https://github.com/sourcelair/xterm.js/blob/8ece306dbe9c7aee13cce9c60fae74202f8660ee/src/Terminal.ts#L960

Perhaps this is relevant to why it's not working for you?

https://github.com/sourcelair/xterm.js/blob/8ece306dbe9c7aee13cce9c60fae74202f8660ee/src/Terminal.ts#L962

@Tyriar Line 960 happens inside a callback to a mousedown event, so the mousemove is only listened to when actually clicking.

Looks like other terminals implement this and it's documented here so this would be a nice to have. Opening it up for PRs, I'm don't think we would want a (api) setting to drive this but rather when we see CSI ? 1003 h turn it on.

I found this which is relevant to the implementation: https://www.bountysource.com/issues/41567993-mouse-mode-1003-is-unlike-xterm

How can we test this? I mean, is there any app we could use to test this behaviour if we implement it?

@skerit do you have an example application that could be used to develop the feature against?

@Tyriar I have a node.js terminal application that you could use this with: https://github.com/skerit/janeway

By default there's only a hover button on the top left, but I could add some indicators on the right.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

circuitry2 picture circuitry2  路  4Comments

kolbe picture kolbe  路  3Comments

zhangjie2012 picture zhangjie2012  路  3Comments

pfitzseb picture pfitzseb  路  3Comments

Mlocik97-issues picture Mlocik97-issues  路  3Comments