From bd3e65df4dc3f46119fe502e1ad502ef6b7873ca Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 10 Jan 2025 20:53:47 +0900 Subject: Trim unsupported OSC sequences (#4169) Fix #4169 --- src/ansi_test.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/ansi_test.go') diff --git a/src/ansi_test.go b/src/ansi_test.go index 05d8131e..e3431231 100644 --- a/src/ansi_test.go +++ b/src/ansi_test.go @@ -337,17 +337,25 @@ func TestExtractColor(t *testing.T) { }) state = nil + var color24 tui.Color = (1 << 24) + (180 << 16) + (190 << 8) + 254 src = "\x1b[1mhello \x1b[22;1;38:2:180:190:254mworld" check(func(offsets *[]ansiOffset, state *ansiState) { if len(*offsets) != 2 { t.Fail() } - var color tui.Color = (1 << 24) + (180 << 16) + (190 << 8) + 254 - if state.fg != color || state.attr != 1 { + if state.fg != color24 || state.attr != 1 { t.Fail() } assert((*offsets)[0], 0, 6, -1, -1, true) - assert((*offsets)[1], 6, 11, color, -1, true) + assert((*offsets)[1], 6, 11, color24, -1, true) + }) + + src = "\x1b]133;A\x1b\\hello \x1b]133;C\x1b\\world" + check(func(offsets *[]ansiOffset, state *ansiState) { + if len(*offsets) != 1 { + t.Fail() + } + assert((*offsets)[0], 0, 11, color24, -1, true) }) } -- cgit v1.2.3