-
Notifications
You must be signed in to change notification settings - Fork 373
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
Mouse click events can't handle > 223 rows/columns #32
Comments
Windows has no problems in that area for sure, there are no terminal emulators of any kind involved. I agree that the limit is probably ok, but if we can resolve that somehow propely, we will. I'm busy with other stuff, so I'm not promising anything soon (except I can add the docs about the limitation). |
AFAICT, to "solve" the problem termbox would either have to do one of:
I might explore the utf-8 option myself, since all the affected systems (where go is supported) should be recent enough to support utf-8 properly, but don't expect a pull request, as I know very little about both termbox and terminal programming to deal with non-trivial problems, and may just give up. |
Any mouse click in top 2 rows. Known issue: when X coordinate is > 223 termbox will send incorrect index which will result in selecting the first tab. nsf/termbox-go#32
Mouse clicks towards the right of very wide windows weren't working. Turns out to be a limitation of the X10 protocol: nsf/termbox-go#32
Termbox uses xterm and urxvt extended modes now if terminal can handle them. Which overcomes this limitation, but it won't work everywhere. To see how exactly your terminal reports mouse coordinates use See commit: 4aa457c414d0392fb8981c975a0b |
The mouse event can only have MouseX, and MouseY values that are in the range 0 to 222 (and -33 should a coordinate be greater than 222).
This happens because the event is sent to termbox is a sequence with a single 8-bit character for each of the X and Y locations and with 33 added to them. If a click occurs outside the range, then 0 is sent as the location, so termbox reports it as -33 (due to the adjustments it makes).
Looking at http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Mouse%20Tracking , the likely cause of this is that termbox is using X10 compatibility mode, which behaves in this manner. According to this page there are several solutions, but they might be to difficult to work with in termbox, or might drop compatability, so the simplest solution might just be to document for the user this limitation, as 222 rows/columns might be big enough for most people.
I've only tested this on OS X, using xterm, but I suspect it affects linux, and bsd systems as well. I have no idea about the situation on Windows.
The text was updated successfully, but these errors were encountered: