Skip to content
Myr

Short-circuit ANSI processing if no ANSI codes are found

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

authored by Junegunn Choi · committed by Junegunn Choi · parent 644277f · Browse files · 1 file+4 added−1 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+4 added−1 removed

  • other:+4 added−1 removed

1 file+4 added−1 removed

modified:src/ansi.go+4 added-1 removed
72 unmodified lines
73 runeCount := 074 for idx := 0; idx < len(str); {75 idx += findAnsiStart(str[idx:])7677 // No sign of ANSI code77 if idx == len(str) {78 // No sign of ANSI code79 if len(offsets) == 0 {80 return str, nil, state81 }82 break83 }8485 // Make sure that we found an ANSI code
150 unmodified lines