Skip to content
Myr

Support OSC 8 sequence with BEL characters

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix #4193

authored by Junegunn Choi · committed by Junegunn Choi · parent 65db735 · Browse files · 1 file+10 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−5 removed

  • other:+10 added−5 removed

1 file+10 added−5 removed

modified:src/ansi.go+10 added-5 removed
356 unmodified lines
357 }358 if ansiCode[0] != '\x1b' || ansiCode[1] != '[' || ansiCode[len(ansiCode)-1] != 'm' {359 if prevState != nil && strings.HasSuffix(ansiCode, "0K") {360 state.lbg = prevState.bg361 } else if ansiCode == "\x1b]8;;\x1b\\" { // End of a hyperlink362 state.url = nil363 } else if strings.HasPrefix(ansiCode, "\x1b]8;") && strings.HasSuffix(ansiCode, "\x1b\\") {364 if paramsEnd := strings.IndexRune(ansiCode[4:], ';'); paramsEnd >= 0 {361 } else if strings.HasPrefix(ansiCode, "\x1b]8;") && (strings.HasSuffix(ansiCode, "\x1b\\") || strings.HasSuffix(ansiCode, "\a")) {362 stLen := 2363 if strings.HasSuffix(ansiCode, "\a") {364 stLen = 1365 }366 // "\x1b]8;;\x1b\\" or "\x1b]8;;\a"367 if len(ansiCode) == 5+stLen && ansiCode[4] == ';' {368 state.url = nil369 } else if paramsEnd := strings.IndexRune(ansiCode[4:], ';'); paramsEnd >= 0 {370 params := ansiCode[4 : 4+paramsEnd]366 uri := ansiCode[5+paramsEnd : len(ansiCode)-2]371 uri := ansiCode[5+paramsEnd : len(ansiCode)-stLen]372 state.url = &url{uri: uri, params: params}373 }374 }375 return state
111 unmodified lines