Revision: 10242 https://osdn.net/projects/ttssh2/scm/svn/commits/10242 Author: zmatsuo Date: 2022-09-05 23:27:17 +0900 (Mon, 05 Sep 2022) Log Message: ----------- カラーパレット変更シーケンスで誤った対象が変更される - 正しく指定できない色番号 - 1-7 -> 9-15 - 9-15 -> 1-7 - color-sgr-decscnm.pl - OSCシーケンス 色設定テストを追加 ticket #45558 Ticket Links: ------------ https://osdn.net/projects/ttssh2/tracker/detail/45558 Modified Paths: -------------- trunk/teraterm/teraterm/vtdisp.c trunk/tests/color-sgr-decscnm.pl -------------- next part -------------- Modified: trunk/teraterm/teraterm/vtdisp.c =================================================================== --- trunk/teraterm/teraterm/vtdisp.c 2022-09-05 13:54:48 UTC (rev 10241) +++ trunk/teraterm/teraterm/vtdisp.c 2022-09-05 14:27:17 UTC (rev 10242) @@ -3566,7 +3566,15 @@ case CS_TEK_BG: ts.TEKColor[1] = color; break; default: if (num <= 255) { - ANSIColor[num] = color; + if (1 <= num && num <= 7) { + num += 8; + ANSIColor[num] = color; + } else if (9 <= num && num <= 15) { + num -= 8; + ANSIColor[num] = color; + } else { + ANSIColor[num] = color; + } } else { return; Modified: trunk/tests/color-sgr-decscnm.pl =================================================================== --- trunk/tests/color-sgr-decscnm.pl 2022-09-05 13:54:48 UTC (rev 10241) +++ trunk/tests/color-sgr-decscnm.pl 2022-09-05 14:27:17 UTC (rev 10242) @@ -2,6 +2,11 @@ local $| = 1; +sub pause { + printf("pause(hit enter)\n"); + <STDIN>; +} + print "\x1b[0m"; print "SGR(Select Graphic Rendition) test\n"; @@ -167,6 +172,23 @@ } } +# OSCシーケンス 色設定 +if (1) { + print "==================== OSC test\n"; + pause(); + + printf("black-white\n"); + for ($i = 0; $i < 16; $i++) { + printf("\x1b]4;%d;#%1x%1x%1x\x1b\\", $i, $i, $i, $i); + } + pause(); + + printf("reset color\n"); + for ($i = 0; $i < 16; $i++) { + printf("\x1b]104;%d\x1b\\", $i, $i, $i, $i); + } +} + # DECSCNM 反転表示モード # DECSET ESC [ ? 5 h 設定 # echo -en "\033[?5h"