summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-08-17 19:11:56 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-08-17 19:12:06 +0900
commit656963e01805efccc788e7e2d83a4bcfaa01ee7b (patch)
tree4663e974dfc4a4101502d7af733c9a2a63e8acd0
parent644277faf17de60125ccb095734628b49d962cd6 (diff)
Short-circuit ANSI processing if no ANSI codes are found
-rw-r--r--src/ansi.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ansi.go b/src/ansi.go
index 5856bd57..70ec5609 100644
--- a/src/ansi.go
+++ b/src/ansi.go
@@ -74,8 +74,11 @@ func extractColor(str string, state *ansiState, proc func(string, *ansiState) bo
for idx := 0; idx < len(str); {
idx += findAnsiStart(str[idx:])
- // No sign of ANSI code
if idx == len(str) {
+ // No sign of ANSI code
+ if len(offsets) == 0 {
+ return str, nil, state
+ }
break
}