Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch implements the legacy X10 mode and the newer SGR and SGR Pixel modes. It omits the EXT and URXVT modes because their use is discouraged anyway (https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking). With the first one the encoding is ambigious and the second one is no improvement over SGR mode. Not implementing them keeps the complexity down and if people actually use them (which they shouldn't) we could still add them in the future.
X10 can only encode a limited number of rows and cols (224) which can be a problem with modern ultra-wide displays. But AFAIK people used it in the past and it is good to have it for compatibility. SGR is the new encoding that fixes X10 and SGR Pixel mode was introduced by xterm in 2020 and allows to track pixels instead of rows and cols and might see more use in the future.
In addition to the unit tests (which I derived from values gathered from xterm) I tested it in midnight commander and clicking as well as scrolling with the mouse wheel worked as expected.