Do not process ANSI codes in --preview output at once

Close #598
This commit is contained in:
Junegunn Choi
2016-06-14 21:52:47 +09:00
parent c39c039e15
commit 24e1fabf2e
5 changed files with 19 additions and 24 deletions

View File

@@ -73,7 +73,7 @@ func Run(opts *Options) {
if opts.Theme != nil {
var state *ansiState
ansiProcessor = func(data []byte) ([]rune, []ansiOffset) {
trimmed, offsets, newState := extractColor(string(data), state)
trimmed, offsets, newState := extractColor(string(data), state, nil)
state = newState
return []rune(trimmed), offsets
}
@@ -81,7 +81,7 @@ func Run(opts *Options) {
// When color is disabled but ansi option is given,
// we simply strip out ANSI codes from the input
ansiProcessor = func(data []byte) ([]rune, []ansiOffset) {
trimmed, _, _ := extractColor(string(data), nil)
trimmed, _, _ := extractColor(string(data), nil, nil)
return []rune(trimmed), nil
}
}