Skip to content
Snippets Groups Projects
Unverified Commit 1cfeec0c authored by Junegunn Choi's avatar Junegunn Choi
Browse files

Fix segmentation fault on \x1b[0K

Fix #2339
parent a0649edc
No related branches found
No related tags found
No related merge requests found
......@@ -201,7 +201,7 @@ func interpretCode(ansiCode string, prevState *ansiState) *ansiState {
state = &ansiState{prevState.fg, prevState.bg, prevState.attr, prevState.lbg}
}
if ansiCode[0] != '\x1b' || ansiCode[1] != '[' || ansiCode[len(ansiCode)-1] != 'm' {
if strings.HasSuffix(ansiCode, "0K") {
if strings.HasSuffix(ansiCode, "0K") && prevState != nil {
state.lbg = prevState.bg
}
return state
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment