--- rxvt-unicode/src/command.C 2021/06/17 00:49:20 1.592 +++ rxvt-unicode/src/command.C 2022/09/18 20:32:17 1.598 @@ -27,7 +27,7 @@ * Copyright (c) 2001 Marius Gedminas * - Ctrl/Mod4+Tab works like Meta+Tab (options) * Copyright (c) 2003 Rob McMullen - * Copyright (c) 2003-2014 Marc Lehmann + * Copyright (c) 2003-2021 Marc Lehmann * Copyright (c) 2007,2015 Emanuele Giaquinta * * This program is free software; you can redistribute it and/or modify @@ -3021,7 +3021,7 @@ tt_printf ("%-.250s\012", rs[Rs_display_name]); break; case 8: /* unofficial extension */ - process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); + process_xterm_seq (XTerm_title, (char *)RESNAME "-" VERSION, CHAR_ST); // char * cast verified break; } break; @@ -3336,15 +3336,22 @@ /* we allow one of the 6 closest neighbouring colours */ /* to replace the current color, if they not used recently */ - static const signed char dxyz[][3] = { + #if 0 + static const unsigned char dxyz[][3] = { 0, 0, 0, 0, 0, 4, - 0, 4, 0, - 4, 0, 0, 0, 4, 4, 4, 4, 0, 4, 0, 4, + 0, 4, 0, + 4, 0, 0, }; + #else + // silly compressed verlapping triplets version of above + static const unsigned char dxyz[] = { + 0, 0, 0, 4, 4, 0, 4, 0, 0, + }; + #endif static const unsigned char color_level[8][32] = { // neighbour index @@ -3361,11 +3368,11 @@ unsigned int idx; - for (int n = 0; n < ecb_array_length (dxyz); ++n) + for (int n = 0; n < ecb_array_length (dxyz) - 2; ++n) { - unsigned int idx_r = color_level[ Red_levels - dxyz[n][0]][r / 8]; - unsigned int idx_g = color_level[Green_levels - dxyz[n][1]][g / 8]; - unsigned int idx_b = color_level[ Blue_levels - dxyz[n][2]][b / 8]; + unsigned int idx_r = color_level[ Red_levels - dxyz[n + 0]][r / 8]; + unsigned int idx_g = color_level[Green_levels - dxyz[n + 1]][g / 8]; + unsigned int idx_b = color_level[ Blue_levels - dxyz[n + 2]][b / 8]; unsigned int index = colorcube_index (idx_r, idx_g, idx_b); if (n == 0) @@ -3385,8 +3392,8 @@ } // like (rgb24_seqno[idx] > rgb24_seqno[index]) - // but also handles wrap around values good enough - if ((uint16_t)(rgb24_seqno[idx] - rgb24_seqno[index]) < 0x7fff) + // but also handles wrap around values well enough + if ((uint16_t)(rgb24_seqno[idx] - rgb24_seqno[index]) < 0x8000) idx = index; } @@ -3407,19 +3414,21 @@ { if (str[0] == '?' && !str[1]) { - if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) - return; - rgba c; pix_colors_focused[color].get (c); - color -= minCOLOR; + char rgba_str[32]; #if XFT if (c.a != rgba::MAX_CC) - tt_printf ("\033]%d;%d;rgba:%04x/%04x/%04x/%04x%c", report, color, c.r, c.g, c.b, c.a, resp); + snprintf (rgba_str, sizeof (rgba_str), "rgba:%04x/%04x/%04x/%04x", c.r, c.g, c.b, c.a); else #endif - tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", report, color, c.r, c.g, c.b, resp); + snprintf (rgba_str, sizeof (rgba_str), "rgb:%04x/%04x/%04x", c.r, c.g, c.b); + + if (IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) + tt_printf ("\033]%d;%d;%s%c", report, color - minCOLOR, rgba_str, resp); + else + tt_printf ("\033]%d;%s%c", report, rgba_str, resp); } else set_window_color (color, str); @@ -3601,6 +3610,13 @@ break; #if !ENABLE_MINIMAL + case URxvt_cellinfo: + if (query) + tt_printf ("\33]%d;%d;%d;%d%c", saveop, + fwidth, fheight, fbase, + resp); + break; + case URxvt_locale: if (query) tt_printf ("\33]%d;%-.250s%c", op, option (Opt_insecure) ? locale : "", resp); @@ -3733,7 +3749,9 @@ // 1048 save and restore cursor, implemented in code { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */ // 1051, 1052, 1060, 1061 keyboard emulation NYI +#if ENABLE_FRILLS { 2004, PrivMode_BracketPaste }, +#endif }; if (nargs == 0)