From 195aae907d0d7138fec789377f9d1889e1661e0a Mon Sep 17 00:00:00 2001 From: Adam Saponara Date: Tue, 31 May 2022 22:05:14 -0400 Subject: [PATCH] add `TB_BLINK` and `TB_TRUECOLOR_*` attributes (#16) --- termbox.h | 72 ++++++++++++++++++----------- tests/test_basic/expected.ansi | 8 ++-- tests/test_basic/test.php | 12 +++-- tests/test_color_true/expected.ansi | 6 +-- tests/test_color_true/test.php | 15 +++--- 5 files changed, 69 insertions(+), 44 deletions(-) diff --git a/termbox.h b/termbox.h index 6e0b99d..fbded2d 100644 --- a/termbox.h +++ b/termbox.h @@ -199,6 +199,14 @@ extern "C" { // __ffi_strip #define TB_UNDERLINE 0x0200 #define TB_REVERSE 0x0400 #define TB_ITALIC 0x0800 +#define TB_BLINK 0x1000 +#ifdef TB_OPT_TRUECOLOR +#define TB_TRUECOLOR_BOLD 0x01000000 +#define TB_TRUECOLOR_UNDERLINE 0x02000000 +#define TB_TRUECOLOR_REVERSE 0x04000000 +#define TB_TRUECOLOR_ITALIC 0x08000000 +#define TB_TRUECOLOR_BLINK 0x10000000 +#endif /* Event types (tb_event.type) */ #define TB_EVENT_KEY 1 @@ -422,11 +430,10 @@ int tb_set_input_mode(int mode); * TB_BLACK, TB_RED, TB_GREEN, TB_YELLOW, * TB_BLUE, TB_MAGENTA, TB_CYAN, TB_WHITE * Colors may be bitwise OR'd with attributes: - * TB_BOLD, TB_UNDERLINE, TB_REVERSE, TB_ITALIC + * TB_BOLD, TB_UNDERLINE, TB_REVERSE, TB_ITALIC, TB_BLINK * - * Some notes: Applying TB_BOLD as a bg attribute will emit an escape code - * for blinking text. TB_REVERSE can be applied as either a fg or bg - * attribute for the same effect. TB_UNDERLINE and TB_ITALIC apply as fg + * Some notes: TB_REVERSE can be applied as either fg or bg attributes for + * the same effect. TB_BOLD, TB_UNDERLINE, TB_ITALIC, TB_BLINK apply as fg * attributes only, and are ignored as bg attributes. * * Example usage: @@ -444,16 +451,16 @@ int tb_set_input_mode(int mode); * tb_set_cell(x, y, '@', 0xb8, 0xf0); * * 3. TB_OUTPUT_216 => [0..215] - * This mode supports the 3rd range of TB_OUTPUT_256 only, but you don't need - * to provide an offset. + * This mode supports the 3rd range of TB_OUTPUT_256 only, but you don't + * need to provide an offset. * * 4. TB_OUTPUT_GRAYSCALE => [0..23] - * This mode supports the 4th range of TB_OUTPUT_256 only, but you dont need - * to provide an offset. + * This mode supports the 4th range of TB_OUTPUT_256 only, but you don't + * need to provide an offset. * * 5. TB_OUTPUT_TRUECOLOR => [0x000000..0xffffff] * This mode provides 24-bit color on supported terminals. The format is - * 0xRRGGBB. + * 0xRRGGBB. Colors may be bitwise OR'd with `TB_TRUECOLOR_*` attributes. * * If mode is TB_OUTPUT_CURRENT, the function returns the current output mode. * @@ -2809,27 +2816,40 @@ static int send_attr(uintattr_t fg, uintattr_t bg) { break; } - if (global.output_mode != TB_OUTPUT_TRUECOLOR) { - if (fg & TB_BOLD) - if_err_return(rv, - bytebuf_puts(&global.out, global.caps[TB_CAP_BOLD])); + uintattr_t attr_bold, attr_blink, attr_italic, attr_underline, attr_reverse; + if (global.output_mode == TB_OUTPUT_TRUECOLOR) { + attr_bold = TB_TRUECOLOR_BOLD; + attr_blink = TB_TRUECOLOR_BLINK; + attr_italic = TB_TRUECOLOR_ITALIC; + attr_underline = TB_TRUECOLOR_UNDERLINE; + attr_reverse = TB_TRUECOLOR_REVERSE; + } else { + attr_bold = TB_BOLD; + attr_blink = TB_BLINK; + attr_italic = TB_ITALIC; + attr_underline = TB_UNDERLINE; + attr_reverse = TB_REVERSE; + } - if (bg & TB_BOLD) - if_err_return(rv, - bytebuf_puts(&global.out, global.caps[TB_CAP_BLINK])); + if (fg & attr_bold) + if_err_return(rv, + bytebuf_puts(&global.out, global.caps[TB_CAP_BOLD])); - if (fg & TB_UNDERLINE) - if_err_return(rv, - bytebuf_puts(&global.out, global.caps[TB_CAP_UNDERLINE])); + if (fg & attr_blink) + if_err_return(rv, + bytebuf_puts(&global.out, global.caps[TB_CAP_BLINK])); - if (fg & TB_ITALIC) - if_err_return(rv, - bytebuf_puts(&global.out, global.caps[TB_CAP_ITALIC])); + if (fg & attr_underline) + if_err_return(rv, + bytebuf_puts(&global.out, global.caps[TB_CAP_UNDERLINE])); - if ((fg & TB_REVERSE) || (bg & TB_REVERSE)) - if_err_return(rv, - bytebuf_puts(&global.out, global.caps[TB_CAP_REVERSE])); - } + if (fg & attr_italic) + if_err_return(rv, + bytebuf_puts(&global.out, global.caps[TB_CAP_ITALIC])); + + if ((fg & attr_reverse) || (bg & attr_reverse)) + if_err_return(rv, + bytebuf_puts(&global.out, global.caps[TB_CAP_REVERSE])); if_err_return(rv, send_sgr(cfg, cbg)); diff --git a/tests/test_basic/expected.ansi b/tests/test_basic/expected.ansi index 7666d00..d3208d2 100644 --- a/tests/test_basic/expected.ansi +++ b/tests/test_basic/expected.ansi @@ -1,5 +1,9 @@ #5width=80 #5height=24 +#5attr=TB_BOLD +#5attr=TB_UNDERLINE +#5attr=TB_ITALIC +#5attr=TB_REVERSE #5event rv=0 type=1 mod=2 key=1 ch=0 w=0 h=0 x=0 y=0 #5out_w=50 @@ -18,7 +22,3 @@ - - - - diff --git a/tests/test_basic/test.php b/tests/test_basic/test.php index 3d22205..5272ada 100755 --- a/tests/test_basic/test.php +++ b/tests/test_basic/test.php @@ -11,8 +11,12 @@ $red = $test->defines['TB_RED']; $green = $test->defines['TB_GREEN']; $blue = $test->defines['TB_BLUE']; -$test->ffi->tb_printf(0, 0, $red, $bg, "width=%d", $w); -$test->ffi->tb_printf(0, 1, $green, $bg, "height=%d", $h); +$y = 0; +$test->ffi->tb_printf(0, $y++, $red, $bg, "width=%d", $w); +$test->ffi->tb_printf(0, $y++, $green, $bg, "height=%d", $h); +foreach (['TB_BOLD', 'TB_UNDERLINE', 'TB_ITALIC', 'TB_REVERSE'] as $attr) { + $test->ffi->tb_printf(0, $y++, $blue | $test->defines[$attr], $bg, "attr=%s", $attr); +} $test->xvkbd('\Ca'); // Ctrl-A @@ -20,7 +24,7 @@ $event = $test->ffi->new('struct tb_event'); $rv = $test->ffi->tb_peek_event(FFI::addr($event), 1000); $out_w = $test->ffi->new('size_t'); -$test->ffi->tb_printf_ex(0, 2, $blue, $bg, FFI::addr($out_w), "event rv=%d type=%d mod=%d key=%d ch=%d w=%d h=%d x=%d y=%d", +$test->ffi->tb_printf_ex(0, $y++, $blue, $bg, FFI::addr($out_w), "event rv=%d type=%d mod=%d key=%d ch=%d w=%d h=%d x=%d y=%d", $rv, $event->type, $event->mod, @@ -32,7 +36,7 @@ $test->ffi->tb_printf_ex(0, 2, $blue, $bg, FFI::addr($out_w), "event rv=%d type= $event->y ); -$test->ffi->tb_printf(0, 3, 0, 0, "out_w=%d", $out_w->cdata); +$test->ffi->tb_printf(0, $y++, 0, 0, "out_w=%d", $out_w->cdata); $test->ffi->tb_present(); diff --git a/tests/test_color_true/expected.ansi b/tests/test_color_true/expected.ansi index 172fcb9..850116f 100644 --- a/tests/test_color_true/expected.ansi +++ b/tests/test_color_true/expected.ansi @@ -15,10 +15,10 @@ #5[0;38:2::128:0:128;48:2::0:0:0mp[0;38:2::128:0:128;48:2::0:0:0mu[0;38:2::128:0:128;48:2::0:0:0mr[0;38:2::128:0:128;48:2::0:0:0mp[0;38:2::128:0:128;48:2::0:0:0ml[0;38:2::128:0:128;48:2::0:0:0me[0;38:2::128:0:128;48:2::0:0:0m [0;38:2::255:0:0;48:2::0:0:0mr[0;38:2::255:0:0;48:2::0:0:0me[0;38:2::255:0:0;48:2::0:0:0md[0;38:2::255:0:0;48:2::0:0:0m [0;38:2::188:143:143;48:2::0:0:0mr[0;38:2::188:143:143;48:2::0:0:0mo[0;38:2::188:143:143;48:2::0:0:0ms[0;38:2::188:143:143;48:2::0:0:0my[0;38:2::188:143:143;48:2::0:0:0mb[0;38:2::188:143:143;48:2::0:0:0mr[0;38:2::188:143:143;48:2::0:0:0mo[0;38:2::188:143:143;48:2::0:0:0mw[0;38:2::188:143:143;48:2::0:0:0mn[0;38:2::188:143:143;48:2::0:0:0m [0;38:2::65:105:225;48:2::0:0:0mr[0;38:2::65:105:225;48:2::0:0:0mo[0;38:2::65:105:225;48:2::0:0:0my[0;38:2::65:105:225;48:2::0:0:0ma[0;38:2::65:105:225;48:2::0:0:0ml[0;38:2::65:105:225;48:2::0:0:0mb[0;38:2::65:105:225;48:2::0:0:0ml[0;38:2::65:105:225;48:2::0:0:0mu[0;38:2::65:105:225;48:2::0:0:0me[0;38:2::65:105:225;48:2::0:0:0m [0;38:2::139:69:19;48:2::0:0:0ms[0;38:2::139:69:19;48:2::0:0:0ma[0;38:2::139:69:19;48:2::0:0:0md[0;38:2::139:69:19;48:2::0:0:0md[0;38:2::139:69:19;48:2::0:0:0ml[0;38:2::139:69:19;48:2::0:0:0me[0;38:2::139:69:19;48:2::0:0:0mb[0;38:2::139:69:19;48:2::0:0:0mr[0;38:2::139:69:19;48:2::0:0:0mo[0;38:2::139:69:19;48:2::0:0:0mw[0;38:2::139:69:19;48:2::0:0:0mn[0;38:2::139:69:19;48:2::0:0:0m [0;38:2::250:128:114;48:2::0:0:0ms[0;38:2::250:128:114;48:2::0:0:0ma[0;38:2::250:128:114;48:2::0:0:0ml[0;38:2::250:128:114;48:2::0:0:0mm[0;38:2::250:128:114;48:2::0:0:0mo[0;38:2::250:128:114;48:2::0:0:0mn[0;38:2::250:128:114;48:2::0:0:0m [0;38:2::244:164:96;48:2::0:0:0ms[0;38:2::244:164:96;48:2::0:0:0ma[0;38:2::244:164:96;48:2::0:0:0mn[0;38:2::244:164:96;48:2::0:0:0md[0;38:2::244:164:96;48:2::0:0:0my[0;38:2::244:164:96;48:2::0:0:0mb[0;38:2::244:164:96;48:2::0:0:0mr[0;38:2::244:164:96;48:2::0:0:0mo[0;38:2::244:164:96;48:2::0:0:0mw[0;38:2::244:164:96;48:2::0:0:0mn[0;38:2::244:164:96;48:2::0:0:0m [0;38:2::46:139:87;48:2::0:0:0ms[0;38:2::46:139:87;48:2::0:0:0me[0;38:2::46:139:87;48:2::0:0:0ma[0;38:2::46:139:87;48:2::0:0:0mg[0;38:2::46:139:87;48:2::0:0:0mr[0;38:2::46:139:87;48:2::0:0:0me[0;38:2::46:139:87;48:2::0:0:0me[0;38:2::46:139:87;48:2::0:0:0mn[0;38:2::46:139:87;48:2::0:0:0m [0;38:2::255:245:238;48:2::0:0:0ms[0;38:2::255:245:238;48:2::0:0:0me[0;38:2::255:245:238;48:2::0:0:0ma[0;38:2::255:245:238;48:2::0:0:0ms[0;38:2::255:245:238;48:2::0:0:0mh[0;38:2::255:245:238;48:2::0:0:0me[0;38:2::255:245:238;48:2::0:0:0ml[0;38:2::255:245:238;48:2::0:0:0ml[0;38:2::255:245:238;48:2::0:0:0m [0;38:2::160:82:45;48:2::0:0:0ms #5[0;38:2::192:192:192;48:2::0:0:0ms[0;38:2::192:192:192;48:2::0:0:0mi[0;38:2::192:192:192;48:2::0:0:0ml[0;38:2::192:192:192;48:2::0:0:0mv[0;38:2::192:192:192;48:2::0:0:0me[0;38:2::192:192:192;48:2::0:0:0mr[0;38:2::192:192:192;48:2::0:0:0m [0;38:2::135:206:235;48:2::0:0:0ms[0;38:2::135:206:235;48:2::0:0:0mk[0;38:2::135:206:235;48:2::0:0:0my[0;38:2::135:206:235;48:2::0:0:0mb[0;38:2::135:206:235;48:2::0:0:0ml[0;38:2::135:206:235;48:2::0:0:0mu[0;38:2::135:206:235;48:2::0:0:0me[0;38:2::135:206:235;48:2::0:0:0m [0;38:2::106:90:205;48:2::0:0:0ms[0;38:2::106:90:205;48:2::0:0:0ml[0;38:2::106:90:205;48:2::0:0:0ma[0;38:2::106:90:205;48:2::0:0:0mt[0;38:2::106:90:205;48:2::0:0:0me[0;38:2::106:90:205;48:2::0:0:0mb[0;38:2::106:90:205;48:2::0:0:0ml[0;38:2::106:90:205;48:2::0:0:0mu[0;38:2::106:90:205;48:2::0:0:0me[0;38:2::106:90:205;48:2::0:0:0m [0;38:2::112:128:144;48:2::0:0:0ms[0;38:2::112:128:144;48:2::0:0:0ml[0;38:2::112:128:144;48:2::0:0:0ma[0;38:2::112:128:144;48:2::0:0:0mt[0;38:2::112:128:144;48:2::0:0:0me[0;38:2::112:128:144;48:2::0:0:0mg[0;38:2::112:128:144;48:2::0:0:0mr[0;38:2::112:128:144;48:2::0:0:0me[0;38:2::112:128:144;48:2::0:0:0my[0;38:2::112:128:144;48:2::0:0:0m [0;38:2::255:250:250;48:2::0:0:0ms[0;38:2::255:250:250;48:2::0:0:0mn[0;38:2::255:250:250;48:2::0:0:0mo[0;38:2::255:250:250;48:2::0:0:0mw[0;38:2::255:250:250;48:2::0:0:0m [0;38:2::0:255:127;48:2::0:0:0ms[0;38:2::0:255:127;48:2::0:0:0mp[0;38:2::0:255:127;48:2::0:0:0mr[0;38:2::0:255:127;48:2::0:0:0mi[0;38:2::0:255:127;48:2::0:0:0mn[0;38:2::0:255:127;48:2::0:0:0mg[0;38:2::0:255:127;48:2::0:0:0mg[0;38:2::0:255:127;48:2::0:0:0mr[0;38:2::0:255:127;48:2::0:0:0me[0;38:2::0:255:127;48:2::0:0:0me[0;38:2::0:255:127;48:2::0:0:0mn[0;38:2::0:255:127;48:2::0:0:0m [0;38:2::70:130:180;48:2::0:0:0ms[0;38:2::70:130:180;48:2::0:0:0mt[0;38:2::70:130:180;48:2::0:0:0me[0;38:2::70:130:180;48:2::0:0:0me[0;38:2::70:130:180;48:2::0:0:0ml[0;38:2::70:130:180;48:2::0:0:0mb[0;38:2::70:130:180;48:2::0:0:0ml[0;38:2::70:130:180;48:2::0:0:0mu[0;38:2::70:130:180;48:2::0:0:0me[0;38:2::70:130:180;48:2::0:0:0m [0;38:2::210:180:140;48:2::0:0:0mt[0;38:2::210:180:140;48:2::0:0:0ma[0;38:2::210:180:140;48:2::0:0:0mn[0;38:2::210:180:140;48:2::0:0:0m [0;38:2::0:128:128;48:2::0:0:0mt[0;38:2::0:128:128;48:2::0:0:0me[0;38:2::0:128:128;48:2::0:0:0ma[0;38:2::0:128:128;48:2::0:0:0ml[0;38:2::0:128:128;48:2::0:0:0m [0;38:2::216:191:216;48:2::0:0:0mt[0;38:2::216:191:216;48:2::0:0:0mh[0;38:2::216:191:216;48:2::0:0:0mi[0;38:2::216:191:216;48:2::0:0:0ms[0;38:2::216:191:216;48:2::0:0:0mt[0;38:2::216:191:216;48:2::0:0:0ml[0;38:2::216:191:216;48:2::0:0:0me[0;38:2::216:191:216;48:2::0:0:0m [0;38:2::255:99:71;48:2::0:0:0mt #5[0;38:2::64:224:208;48:2::0:0:0mt[0;38:2::64:224:208;48:2::0:0:0mu[0;38:2::64:224:208;48:2::0:0:0mr[0;38:2::64:224:208;48:2::0:0:0mq[0;38:2::64:224:208;48:2::0:0:0mu[0;38:2::64:224:208;48:2::0:0:0mo[0;38:2::64:224:208;48:2::0:0:0mi[0;38:2::64:224:208;48:2::0:0:0ms[0;38:2::64:224:208;48:2::0:0:0me[0;38:2::64:224:208;48:2::0:0:0m [0;38:2::238:130:238;48:2::0:0:0mv[0;38:2::238:130:238;48:2::0:0:0mi[0;38:2::238:130:238;48:2::0:0:0mo[0;38:2::238:130:238;48:2::0:0:0ml[0;38:2::238:130:238;48:2::0:0:0me[0;38:2::238:130:238;48:2::0:0:0mt[0;38:2::238:130:238;48:2::0:0:0m [0;38:2::245:222:179;48:2::0:0:0mw[0;38:2::245:222:179;48:2::0:0:0mh[0;38:2::245:222:179;48:2::0:0:0me[0;38:2::245:222:179;48:2::0:0:0ma[0;38:2::245:222:179;48:2::0:0:0mt[0;38:2::245:222:179;48:2::0:0:0m [0;38:2::255:255:255;48:2::0:0:0mw[0;38:2::255:255:255;48:2::0:0:0mh[0;38:2::255:255:255;48:2::0:0:0mi[0;38:2::255:255:255;48:2::0:0:0mt[0;38:2::255:255:255;48:2::0:0:0me[0;38:2::255:255:255;48:2::0:0:0m [0;38:2::245:245:245;48:2::0:0:0mw[0;38:2::245:245:245;48:2::0:0:0mh[0;38:2::245:245:245;48:2::0:0:0mi[0;38:2::245:245:245;48:2::0:0:0mt[0;38:2::245:245:245;48:2::0:0:0me[0;38:2::245:245:245;48:2::0:0:0ms[0;38:2::245:245:245;48:2::0:0:0mm[0;38:2::245:245:245;48:2::0:0:0mo[0;38:2::245:245:245;48:2::0:0:0mk[0;38:2::245:245:245;48:2::0:0:0me[0;38:2::245:245:245;48:2::0:0:0m [0;38:2::255:255:0;48:2::0:0:0my[0;38:2::255:255:0;48:2::0:0:0me[0;38:2::255:255:0;48:2::0:0:0ml[0;38:2::255:255:0;48:2::0:0:0ml[0;38:2::255:255:0;48:2::0:0:0mo[0;38:2::255:255:0;48:2::0:0:0mw[0;38:2::255:255:0;48:2::0:0:0m [0;38:2::154:205:50;48:2::0:0:0my[0;38:2::154:205:50;48:2::0:0:0me[0;38:2::154:205:50;48:2::0:0:0ml[0;38:2::154:205:50;48:2::0:0:0ml[0;38:2::154:205:50;48:2::0:0:0mo[0;38:2::154:205:50;48:2::0:0:0mw[0;38:2::154:205:50;48:2::0:0:0mg[0;38:2::154:205:50;48:2::0:0:0mr[0;38:2::154:205:50;48:2::0:0:0me[0;38:2::154:205:50;48:2::0:0:0me[0;38:2::154:205:50;48:2::0:0:0mn[0;38:2::154:205:50;48:2::0:0:0m  -#5[0;38:2::128:129:128;48:2::0:0:0mn[0;38:2::128:129:128;48:2::0:0:0mo[0;38:2::128:129:128;48:2::0:0:0m [0;38:2::128:129:128;48:2::0:0:0mb[0;38:2::128:129:128;48:2::0:0:0mo[0;38:2::128:129:128;48:2::0:0:0ml[0;38:2::128:129:128;48:2::0:0:0md[0;38:2::128:129:128;48:2::0:0:0m [0;38:2::128:129:128;48:2::0:0:0m([0;38:2::128:129:128;48:2::0:0:0m#[0;38:2::128:129:128;48:2::0:0:0m8[0;38:2::128:129:128;48:2::0:0:0m0[0;38:2::128:129:128;48:2::0:0:0m8[0;38:2::128:129:128;48:2::0:0:0m1[0;38:2::128:129:128;48:2::0:0:0m8[0;38:2::128:129:128;48:2::0:0:0m0[0;38:2::128:129:128;48:2::0:0:0m) -#5[0;38:2::128:130:128;48:2::0:0:0mn[0;38:2::128:130:128;48:2::0:0:0mo[0;38:2::128:130:128;48:2::0:0:0m [0;38:2::128:130:128;48:2::0:0:0mu[0;38:2::128:130:128;48:2::0:0:0mn[0;38:2::128:130:128;48:2::0:0:0md[0;38:2::128:130:128;48:2::0:0:0me[0;38:2::128:130:128;48:2::0:0:0mr[0;38:2::128:130:128;48:2::0:0:0ml[0;38:2::128:130:128;48:2::0:0:0mi[0;38:2::128:130:128;48:2::0:0:0mn[0;38:2::128:130:128;48:2::0:0:0me[0;38:2::128:130:128;48:2::0:0:0m [0;38:2::128:130:128;48:2::0:0:0m([0;38:2::128:130:128;48:2::0:0:0m#[0;38:2::128:130:128;48:2::0:0:0m8[0;38:2::128:130:128;48:2::0:0:0m0[0;38:2::128:130:128;48:2::0:0:0m8[0;38:2::128:130:128;48:2::0:0:0m2[0;38:2::128:130:128;48:2::0:0:0m8[0;38:2::128:130:128;48:2::0:0:0m0[0;38:2::128:130:128;48:2::0:0:0m) +#5[0;1;38:2::128:128:120;48:2::0:0:0my[0;1;38:2::128:128:120;48:2::0:0:0me[0;1;38:2::128:128:120;48:2::0:0:0ms[0;1;38:2::128:128:120;48:2::0:0:0m [0;1;38:2::128:128:120;48:2::0:0:0mb[0;1;38:2::128:128:120;48:2::0:0:0mo[0;1;38:2::128:128:120;48:2::0:0:0ml[0;1;38:2::128:128:120;48:2::0:0:0md[0;1;38:2::128:128:120;48:2::0:0:0m [0;1;38:2::128:128:120;48:2::0:0:0m([0;1;38:2::128:128:120;48:2::0:0:0m#[0;1;38:2::128:128:120;48:2::0:0:0m1[0;1;38:2::128:128:120;48:2::0:0:0m8[0;1;38:2::128:128:120;48:2::0:0:0m0[0;1;38:2::128:128:120;48:2::0:0:0m8[0;1;38:2::128:128:120;48:2::0:0:0m0[0;1;38:2::128:128:120;48:2::0:0:0m8[0;1;38:2::128:128:120;48:2::0:0:0m0[0;1;38:2::128:128:120;48:2::0:0:0m) +#5[0;4;38:2::128:128:128;48:2::0:0:0my[0;4;38:2::128:128:128;48:2::0:0:0me[0;4;38:2::128:128:128;48:2::0:0:0ms[0;4;38:2::128:128:128;48:2::0:0:0m [0;4;38:2::128:128:128;48:2::0:0:0mu[0;4;38:2::128:128:128;48:2::0:0:0mn[0;4;38:2::128:128:128;48:2::0:0:0md[0;4;38:2::128:128:128;48:2::0:0:0me[0;4;38:2::128:128:128;48:2::0:0:0mr[0;4;38:2::128:128:128;48:2::0:0:0ml[0;4;38:2::128:128:128;48:2::0:0:0mi[0;4;38:2::128:128:128;48:2::0:0:0mn[0;4;38:2::128:128:128;48:2::0:0:0me[0;4;38:2::128:128:128;48:2::0:0:0m [0;4;38:2::128:128:128;48:2::0:0:0m([0;4;38:2::128:128:128;48:2::0:0:0m#[0;4;38:2::128:128:128;48:2::0:0:0m2[0;4;38:2::128:128:128;48:2::0:0:0m8[0;4;38:2::128:128:128;48:2::0:0:0m0[0;4;38:2::128:128:128;48:2::0:0:0m8[0;4;38:2::128:128:128;48:2::0:0:0m0[0;4;38:2::128:128:128;48:2::0:0:0m8[0;4;38:2::128:128:128;48:2::0:0:0m0[0;4;38:2::128:128:128;48:2::0:0:0m) +#5[0;3;38:2::128:128:128;48:2::0:0:0my[0;3;38:2::128:128:128;48:2::0:0:0me[0;3;38:2::128:128:128;48:2::0:0:0ms[0;3;38:2::128:128:128;48:2::0:0:0m [0;3;38:2::128:128:128;48:2::0:0:0mi[0;3;38:2::128:128:128;48:2::0:0:0mt[0;3;38:2::128:128:128;48:2::0:0:0ma[0;3;38:2::128:128:128;48:2::0:0:0ml[0;3;38:2::128:128:128;48:2::0:0:0mi[0;3;38:2::128:128:128;48:2::0:0:0mc[0;3;38:2::128:128:128;48:2::0:0:0m [0;3;38:2::128:128:128;48:2::0:0:0m([0;3;38:2::128:128:128;48:2::0:0:0m#[0;3;38:2::128:128:128;48:2::0:0:0m8[0;3;38:2::128:128:128;48:2::0:0:0m8[0;3;38:2::128:128:128;48:2::0:0:0m0[0;3;38:2::128:128:128;48:2::0:0:0m8[0;3;38:2::128:128:128;48:2::0:0:0m0[0;3;38:2::128:128:128;48:2::0:0:0m8[0;3;38:2::128:128:128;48:2::0:0:0m0[0;3;38:2::128:128:128;48:2::0:0:0m) #5[0;38:2::0:0:0;48:2::255:255:255m#[0;38:2::0:0:0;48:2::255:255:255m0[0;38:2::0:0:0;48:2::255:255:255m0[0;38:2::0:0:0;48:2::255:255:255m0[0;38:2::0:0:0;48:2::255:255:255m0[0;38:2::0:0:0;48:2::255:255:255m0[0;38:2::0:0:0;48:2::255:255:255m0[0;38:2::0:0:0;48:2::255:255:255m [0;38:2::0:0:0;48:2::255:255:255mo[0;38:2::0:0:0;48:2::255:255:255mn[0;38:2::0:0:0;48:2::255:255:255m [0;38:2::0:0:0;48:2::255:255:255m#[0;38:2::0:0:0;48:2::255:255:255mf[0;38:2::0:0:0;48:2::255:255:255mf[0;38:2::0:0:0;48:2::255:255:255mf[0;38:2::0:0:0;48:2::255:255:255mf[0;38:2::0:0:0;48:2::255:255:255mf[0;38:2::0:0:0;48:2::255:255:255mf[0;38:2::0:0:0;48:2::255:255:255m [0;38:2::0:0:255;48:2::255:255:0m#[0;38:2::0:0:255;48:2::255:255:0m0[0;38:2::0:0:255;48:2::255:255:0m0[0;38:2::0:0:255;48:2::255:255:0m0[0;38:2::0:0:255;48:2::255:255:0m0[0;38:2::0:0:255;48:2::255:255:0mf[0;38:2::0:0:255;48:2::255:255:0mf[0;38:2::0:0:255;48:2::255:255:0m [0;38:2::0:0:255;48:2::255:255:0mo[0;38:2::0:0:255;48:2::255:255:0mn[0;38:2::0:0:255;48:2::255:255:0m [0;38:2::0:0:255;48:2::255:255:0m#[0;38:2::0:0:255;48:2::255:255:0mf[0;38:2::0:0:255;48:2::255:255:0mf[0;38:2::0:0:255;48:2::255:255:0mf[0;38:2::0:0:255;48:2::255:255:0mf[0;38:2::0:0:255;48:2::255:255:0m0[0;38:2::0:0:255;48:2::255:255:0m0[0;38:2::0:0:255;48:2::255:255:0m [0;38:2::0:255:0;48:2::255:0:255m#[0;38:2::0:255:0;48:2::255:0:255m0[0;38:2::0:255:0;48:2::255:0:255m0[0;38:2::0:255:0;48:2::255:0:255mf[0;38:2::0:255:0;48:2::255:0:255mf[0;38:2::0:255:0;48:2::255:0:255m0[0;38:2::0:255:0;48:2::255:0:255m0[0;38:2::0:255:0;48:2::255:0:255m [0;38:2::0:255:0;48:2::255:0:255mo[0;38:2::0:255:0;48:2::255:0:255mn[0;38:2::0:255:0;48:2::255:0:255m [0;38:2::0:255:0;48:2::255:0:255m#[0;38:2::0:255:0;48:2::255:0:255mf[0;38:2::0:255:0;48:2::255:0:255mf[0;38:2::0:255:0;48:2::255:0:255m0[0;38:2::0:255:0;48:2::255:0:255m0[0;38:2::0:255:0;48:2::255:0:255mf[0;38:2::0:255:0;48:2::255:0:255mf[0;38:2::0:255:0;48:2::255:0:255m [0;38:2::0:255:255;48:2::255:0:0m#[0;38:2::0:255:255;48:2::255:0:0m0[0;38:2::0:255:255;48:2::255:0:0m0[0;38:2::0:255:255;48:2::255:0:0mf[0;38:2::0:255:255;48:2::255:0:0mf[0;38:2::0:255:255;48:2::255:0:0mf[0;38:2::0:255:255;48:2::255:0:0mf[0;38:2::0:255:255;48:2::255:0:0m [0;38:2::0:255:255;48:2::255:0:0mo[0;38:2::0:255:255;48:2::255:0:0mn[0;38:2::0:255:255;48:2::255:0:0m [0;38:2::0:255:255;48:2::255:0:0m#[0;38:2::0:255:255;48:2::255:0:0mf[0;38:2::0:255:255;48:2::255:0:0mf[0;38:2::0:255:255;48:2::255:0:0m0[0;38:2::0:255:255;48:2::255:0:0m0[0;38:2::0:255:255;48:2::255:0:0m0[0;38:2::0:255:255;48:2::255:0:0m0[0;38:2::0:255:255;48:2::255:0:0m [0;38:2::255:0:0;48:2::0:255:255m#[0;38:2::255:0:0;48:2::0:255:255mf[0;38:2::255:0:0;48:2::0:255:255mf[0;38:2::255:0:0;48:2::0:255:255m0 #5[0;38:2::255:0:255;48:2::0:255:0m#[0;38:2::255:0:255;48:2::0:255:0mf[0;38:2::255:0:255;48:2::0:255:0mf[0;38:2::255:0:255;48:2::0:255:0m0[0;38:2::255:0:255;48:2::0:255:0m0[0;38:2::255:0:255;48:2::0:255:0mf[0;38:2::255:0:255;48:2::0:255:0mf[0;38:2::255:0:255;48:2::0:255:0m [0;38:2::255:0:255;48:2::0:255:0mo[0;38:2::255:0:255;48:2::0:255:0mn[0;38:2::255:0:255;48:2::0:255:0m [0;38:2::255:0:255;48:2::0:255:0m#[0;38:2::255:0:255;48:2::0:255:0m0[0;38:2::255:0:255;48:2::0:255:0m0[0;38:2::255:0:255;48:2::0:255:0mf[0;38:2::255:0:255;48:2::0:255:0mf[0;38:2::255:0:255;48:2::0:255:0m0[0;38:2::255:0:255;48:2::0:255:0m0[0;38:2::255:0:255;48:2::0:255:0m [0;38:2::255:255:0;48:2::0:0:255m#[0;38:2::255:255:0;48:2::0:0:255mf[0;38:2::255:255:0;48:2::0:0:255mf[0;38:2::255:255:0;48:2::0:0:255mf[0;38:2::255:255:0;48:2::0:0:255mf[0;38:2::255:255:0;48:2::0:0:255m0[0;38:2::255:255:0;48:2::0:0:255m0[0;38:2::255:255:0;48:2::0:0:255m [0;38:2::255:255:0;48:2::0:0:255mo[0;38:2::255:255:0;48:2::0:0:255mn[0;38:2::255:255:0;48:2::0:0:255m [0;38:2::255:255:0;48:2::0:0:255m#[0;38:2::255:255:0;48:2::0:0:255m0[0;38:2::255:255:0;48:2::0:0:255m0[0;38:2::255:255:0;48:2::0:0:255m0[0;38:2::255:255:0;48:2::0:0:255m0[0;38:2::255:255:0;48:2::0:0:255mf[0;38:2::255:255:0;48:2::0:0:255mf[0;38:2::255:255:0;48:2::0:0:255m [0;38:2::255:255:255;48:2::0:0:0m#[0;38:2::255:255:255;48:2::0:0:0mf[0;38:2::255:255:255;48:2::0:0:0mf[0;38:2::255:255:255;48:2::0:0:0mf[0;38:2::255:255:255;48:2::0:0:0mf[0;38:2::255:255:255;48:2::0:0:0mf[0;38:2::255:255:255;48:2::0:0:0mf[0;38:2::255:255:255;48:2::0:0:0m [0;38:2::255:255:255;48:2::0:0:0mo[0;38:2::255:255:255;48:2::0:0:0mn[0;38:2::255:255:255;48:2::0:0:0m [0;38:2::255:255:255;48:2::0:0:0m#[0;38:2::255:255:255;48:2::0:0:0m0[0;38:2::255:255:255;48:2::0:0:0m0[0;38:2::255:255:255;48:2::0:0:0m0[0;38:2::255:255:255;48:2::0:0:0m0[0;38:2::255:255:255;48:2::0:0:0m0[0;38:2::255:255:255;48:2::0:0:0m0[0;38:2::255:255:255;48:2::0:0:0m  - diff --git a/tests/test_color_true/test.php b/tests/test_color_true/test.php index 0e609af..32ba877 100755 --- a/tests/test_color_true/test.php +++ b/tests/test_color_true/test.php @@ -167,17 +167,18 @@ foreach ($css_colors as $color_name => $fg) { } } -// We should not be emitting bold, underline, etc in true-color mode +// Test bold, underline, italic in true-color mode $x = 0; -$color = 0x808080 | $test->defines['TB_BOLD']; -$test->ffi->tb_printf($x, ++$y, $color, 0, 'no bold (#%06x)', $color); -$color = 0x808080 | $test->defines['TB_UNDERLINE']; -$test->ffi->tb_printf($x, ++$y, $color, 0, 'no underline (#%06x)', $color); -$color = 0x808080 | $test->defines['TB_ITALIC']; -$test->ffi->tb_printf($x, ++$y, $color, 0, 'no italic (#%06x)', $color); +$color = 0x808080 | $test->defines['TB_TRUECOLOR_BOLD']; +$test->ffi->tb_printf($x, ++$y, $color, 0, 'yes bold (#%06x)', $color); +$color = 0x808080 | $test->defines['TB_TRUECOLOR_UNDERLINE']; +$test->ffi->tb_printf($x, ++$y, $color, 0, 'yes underline (#%06x)', $color); +$color = 0x808080 | $test->defines['TB_TRUECOLOR_ITALIC']; +$test->ffi->tb_printf($x, ++$y, $color, 0, 'yes italic (#%06x)', $color); // Test fg/bg together $x = 0; +$y += 1; for ($r = 0x00; $r <= 0xff; $r += 0xff) { for ($g = 0x00; $g <= 0xff; $g += 0xff) { for ($b = 0x00; $b <= 0xff; $b += 0xff) { -- 2.39.5