Fix OSC 8 parser

This commit is contained in:
Junegunn Choi 2024-08-14 19:16:48 +09:00
parent d90a969c00
commit 581734c369
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -355,7 +355,7 @@ func interpretCode(ansiCode string, prevState *ansiState) ansiState {
if ansiCode[0] != '\x1b' || ansiCode[1] != '[' || ansiCode[len(ansiCode)-1] != 'm' { if ansiCode[0] != '\x1b' || ansiCode[1] != '[' || ansiCode[len(ansiCode)-1] != 'm' {
if prevState != nil && strings.HasSuffix(ansiCode, "0K") { if prevState != nil && strings.HasSuffix(ansiCode, "0K") {
state.lbg = prevState.bg state.lbg = prevState.bg
} else if ansiCode == "\x1b]8;;\x1b" { // End of a hyperlink } else if ansiCode == "\x1b]8;;\x1b\\" { // End of a hyperlink
state.url = nil state.url = nil
} else if strings.HasPrefix(ansiCode, "\x1b]8;") && strings.HasSuffix(ansiCode, "\x1b\\") { } else if strings.HasPrefix(ansiCode, "\x1b]8;") && strings.HasSuffix(ansiCode, "\x1b\\") {
if paramsEnd := strings.IndexRune(ansiCode[4:], ';'); paramsEnd >= 0 { if paramsEnd := strings.IndexRune(ansiCode[4:], ';'); paramsEnd >= 0 {