ab5tract / Terminal-Print

Terminal::Print is a pure Raku layer for printing to terminal screens
Other
25 stars 18 forks source link

decoded-input.p6 example doesn't work in urxvt terminal #67

Closed hythm7 closed 2 years ago

hythm7 commented 5 years ago

Mouse events are not working in Urxvt terminal (Works fine on XTerm):

Running decoded-input.p6 and click left mouse button produces this output:

perl6 /tmp/terminal-print.p6
got:  27  1B  ^[
got:  91  5B   [
got:  77  4D   M
got:  32  20    
got:  91  5B   [
got:  75  4B   K
got:  27  1B  ^[
got:  91  5B   [
got:  77  4D   M
got:  35  23   #
got:  91  5B   [
got:  75  4B   K
got:  27  1B  ^[
got:  91  5B   [
got:  77  4D   M
got:  67  43   C
got:  91  5B   [
got:  75  4B   K
got: 113  71   q
kuerbis commented 2 years ago

Looks like urxvt terminals don't support the SGR 1006 mode:

1006 -> report back as decimal values (xterm, many other terminal emulators, but not urxvt) https://stackoverflow.com/a/5970472

japhb commented 2 years ago

@kuerbis You are correct that the Terminal::Print mouse input decoder is only supporting SGR 1006 encoding.

Honestly I expected that urxvt would eventually support 1006, so didn't bother trying to support the dead-end 1005 and 1015 extensions; see https://midnight-commander.org/ticket/2956 for example where other developers (9 years ago!) were pretty sure that everyone would support 1006, and 1015 could only arguably be kept for a while during transition; see also https://savannah.gnu.org/bugs/?37206 wherein the screen developers decide to turn off 1015 support in 2018 specifically to put pressure on urxvt to get with the program. I'm kinda saddened to hear that urxvt is still not supporting 1006, since (according to https://midnight-commander.org/ticket/2956 at least) this was due to personal issues already lingering a decade ago.

I'm going to close this ticket based on decade-long agreement in the FOSS community that 1015 is not worth supporting, and thus I don't plan to do it myself.

That said, if someone went through the effort to write dual 1015/1006 handling and the patch was beautiful and had no other downsides, I would consider merging it, because I have a soft spot for people who make the extra effort to do the really annoying portability work that everyone just assumes someone else will do. (Yes, I see the potential irony in this statement; I'm not assuming someone else will do the work, just acknowledging that someone might.)