这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Sep 24, 2019

Fix for issue described in #1262.

@fornwall
Copy link
Member

fornwall commented Oct 2, 2019

As we discussed, this means we only send the "button press" event, and never the "button release" event. So this should cause issues such as the text selection in micro to be triggered a lot more, right?

@ghost ghost force-pushed the issue1262-fix branch 2 times, most recently from c1272a0 to a73255c Compare October 4, 2019 22:17
@ghost
Copy link
Author

ghost commented Oct 4, 2019

For me it fixes behaviour described in #1262 completely I do not experience selection triggering a lot more.

We discussed about sending "press" event in onDown() and "release" event in onUp(). However the function onDown() has a different signature and doesn't receive MotionEvent argument like onUp().

@fornwall
Copy link
Member

fornwall commented Oct 5, 2019

In the onUp() method we send two mouse events directly - mouse pressed and mouse released.

The byte sequence sent to the terminal from Termux, in the SGR scheme mostly used by programs now, should look like this:

0033  27 0x1B Escape '^[' or '\e'
0133  91 0x5B ASCII '['
0074  60 0x3C ASCII '<'
0060  48 0x30 ASCII '0'
0073  59 0x3B ASCII ';'
0065  53 0x35 ASCII '5'
0063  51 0x33 ASCII '3'
0073  59 0x3B ASCII ';'
0062  50 0x32 ASCII '2'
0061  49 0x31 ASCII '1'
0115  77 0x4D ASCII 'M'

0033  27 0x1B Escape '^[' or '\e'
0133  91 0x5B ASCII '['
0074  60 0x3C ASCII '<'
0060  48 0x30 ASCII '0'
0073  59 0x3B ASCII ';'
0065  53 0x35 ASCII '5'
0063  51 0x33 ASCII '3'
0073  59 0x3B ASCII ';'
0062  50 0x32 ASCII '2'
0061  49 0x31 ASCII '1'
0155 109 0x6D ASCII 'm'

where the format is (https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking):

SGR (1006)
          The normal mouse response is altered to use
          -   CSI < followed by semicolon-separated
          -   encoded button value,
          -   Px and Py ordinates and
          -   a final character which is M  for button press and m for button release.

This can be seen by executing vtshowkeys -m and touching the terminal.

Under tmux however, what the program (vtshowkeys) sees is often m (button release) coming before M (button press) - it seems that tmux (sometimes/quite often) reverses the order of these events. I don't know why that is.

An asciinema recording showing the issue:
https://asciinema.org/a/9RECJwPr2eVUN4NfwVun8nUUQ

I've created a tmux issue for it:
tmux/tmux#1931

UPDATE: Seems to be fixed in tmux master, to be included in the next tmux release (3.0). Backported to the Termux tmux package, at version 2.9a-5.

@fornwall
Copy link
Member

fornwall commented Oct 5, 2019

@xeffyr At least the text selection issue of micro under tmux is fixed after updating to version 2.9a-5 of tmux, right?

@ghost
Copy link
Author

ghost commented Oct 6, 2019

Well, that explains why issue was reproducible only under tmux. I'm closing pull request as latest update fixed it.

@ghost ghost closed this Oct 6, 2019
@ghost ghost deleted the issue1262-fix branch October 6, 2019 11:21
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant