Hi, I've been comparing terminal emulators and as a result, I'm attaching two patches, as per subject.
I've also tried implementing 1006 but that involves more work than expected. Best regards, Přemysl Eric Janouch
From 9bb409688428ead31d6773e1434487ea721c8b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= <p...@janouch.name> Date: Mon, 14 Sep 2020 19:06:42 +0200 Subject: [PATCH 1/3] Implement DECRQM This is useful for feature detection. --- src/command.C | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/command.C b/src/command.C index d53da1e5..91de628c 100644 --- a/src/command.C +++ b/src/command.C @@ -2867,6 +2867,8 @@ rxvt_term::process_csi_seq () case '?': if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') process_terminal_mode (ch, priv, nargs, arg); + if (prev_ch == '$' && ch == 'p') /* DECRQM */ + process_terminal_mode (ch, priv, nargs, arg); break; case '!': @@ -3722,6 +3724,23 @@ rxvt_term::process_terminal_mode (int mode, int priv ecb_unused, unsigned int na if (nargs == 0) return; + if (mode == 'p') /* DECRQM */ + { + int status = 0; /* unknown */ + if (nargs != 1) + return; + for (j = 0; j < ecb_array_length (argtopriv); j++) + if (argtopriv[j].argval == arg[0]) + { + status = (priv_modes & argtopriv[j].bit) ? 1 : 2; + break; + } + tt_printf ("\33[?%d;%d$y", + arg[0], + status); + return; + } + /* make lo/hi boolean */ if (mode == 'l') mode = 0; /* reset */ -- 2.28.0
From 84d38ebb3c19f1371529f7fa0ba79163434353db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= <p...@janouch.name> Date: Mon, 14 Sep 2020 19:08:20 +0200 Subject: [PATCH 2/3] Fix OSC 4 colour retrieval At least xterm, VTE, pterm and mlterm follow the specification (xterm's ctlseqs) in that: For colors and font, if Pt is a "?", the control sequence elicits a response which consists of the control sequence which would set the corresponding value. The response now contains the index of the requested colour. While this change also has an effect on other OSC commands that may not be using indexed colours, the previous quirky behaviour isn't documented in urxvt(7) and it's highly questionable that applications rely on it. (And if they do, some form of special casing could be added to retain backwards compatibility.) --- src/command.C | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/command.C b/src/command.C index 91de628c..34b29989 100644 --- a/src/command.C +++ b/src/command.C @@ -3397,15 +3397,19 @@ rxvt_term::process_color_seq (int report, int color, const char *str, char resp) { if (str[0] == '?' && !str[1]) { + if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) + return; + rgba c; pix_colors_focused[color].get (c); + color -= minCOLOR; #if XFT if (c.a != rgba::MAX_CC) - tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.r, c.g, c.b, c.a, resp); + tt_printf ("\033]%d;%d;rgba:%04x/%04x/%04x/%04x%c", report, color, c.r, c.g, c.b, c.a, resp); else #endif - tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, c.r, c.g, c.b, resp); + tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", report, color, c.r, c.g, c.b, resp); } else set_window_color (color, str); -- 2.28.0
_______________________________________________ rxvt-unicode mailing list rxvt-unicode@lists.schmorp.de http://lists.schmorp.de/mailman/listinfo/rxvt-unicode