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

Xterm.js's encoding of mouse coordinate #812

Closed
johnpoth opened this issue Jul 21, 2017 · 3 comments
Closed

Xterm.js's encoding of mouse coordinate #812

johnpoth opened this issue Jul 21, 2017 · 3 comments
Labels
area/mouse-support type/bug Something is misbehaving
Milestone

Comments

@johnpoth
Copy link
Contributor

It seems there is a bit of discrepancy between Xterm.js's encoding of mouse coordinates and blessed.js's decoding when the coordinate is greater than 127. When the coordinate is greater than 127 (7bits), Xterm.js encodes it using two characters whereas blessed.js assumes just one. Furthermore, Xterm.js uses at most 11 bits for encoding. After changing the limit to 255 in Xterm.js compatibility is restored :)

After reading the spec I am not sure who is right.

I am leaving the 'Details' and 'Step to reproduce' sections blank as I don't think they are relevant here.

Let me know if you need more information,

John.

Details

  • Browser and browser version:
  • OS version:
  • xterm.js version:

Steps to reproduce

@Tyriar
Copy link
Member

Tyriar commented Jul 21, 2017

In this sort of case I think it's best to see what other terminal emulators do such as iTerm2, Terminal.app, gnome-terminal, konsole, etc.

@jerch
Copy link
Member

jerch commented Jul 24, 2017

Btw the xterm spec notes several mouse tracking protocols, which should all be supported by xterm.js to get the best application coverage:

  • X10 (old standard with limited range support, coords are limited to 256-33)
  • 1005: UTF-8 encoded (basically the same as X10 but the coords are UTF-8 encoded, therefore a greater range possible)
  • 1006: SGR encoded (coords as decimal SGR parameters, release vs. press is encoded by 'm' vs. 'M')
  • 1015: URXVT encoded (almost the same as SGR, release is encoded by separate button definitions)

It is up to the application to choose one of those (I assume blessed uses X10 from your description).

@egmontkob
Copy link

egmontkob commented Nov 28, 2017

See mc bug and first comment 2662 and bug 2956.

tl;dr: IMO implement the default (works up to coordinates 223; coordinate is always encoded as a single byte even in UTF-8, that is, the stream is not valid UTF-8) and the SGR 1006 mode, forget the other two :)

@Tyriar Tyriar added type/bug Something is misbehaving area/mouse-support and removed needs more info labels Jun 3, 2018
@Tyriar Tyriar added this to the 3.13.0 milestone Mar 8, 2019
Tyriar added a commit that referenced this issue Mar 8, 2019
Fix for issue #812: Xterm.js's encoding of mouse coordinate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mouse-support type/bug Something is misbehaving
Projects
None yet
Development

No branches or pull requests

4 participants