summaryrefslogtreecommitdiffstats
path: root/src/core.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-03-22 16:05:54 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-03-22 16:05:54 +0900
commitb431e227da318931a4e7458f3cc07616c6b74ea4 (patch)
tree78ea8c61a8399f27f268c58346cf1a5c97b5eed9 /src/core.go
parentd94dfe087694d68073f01a51c7357fc4741641d8 (diff)
Code cleanup
Diffstat (limited to 'src/core.go')
-rw-r--r--src/core.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core.go b/src/core.go
index d561ab40..ebb7d66c 100644
--- a/src/core.go
+++ b/src/core.go
@@ -64,20 +64,20 @@ func Run(options *Options) {
eventBox := util.NewEventBox()
// ANSI code processor
- extractColors := func(data *string) (*string, []AnsiOffset) {
+ ansiProcessor := func(data *string) (*string, []ansiOffset) {
// By default, we do nothing
return data, nil
}
if opts.Ansi {
if opts.Color {
- extractColors = func(data *string) (*string, []AnsiOffset) {
- return ExtractColor(data)
+ ansiProcessor = func(data *string) (*string, []ansiOffset) {
+ return extractColor(data)
}
} else {
// When color is disabled but ansi option is given,
// we simply strip out ANSI codes from the input
- extractColors = func(data *string) (*string, []AnsiOffset) {
- trimmed, _ := ExtractColor(data)
+ ansiProcessor = func(data *string) (*string, []ansiOffset) {
+ trimmed, _ := extractColor(data)
return trimmed, nil
}
}
@@ -87,7 +87,7 @@ func Run(options *Options) {
var chunkList *ChunkList
if len(opts.WithNth) == 0 {
chunkList = NewChunkList(func(data *string, index int) *Item {
- data, colors := extractColors(data)
+ data, colors := ansiProcessor(data)
return &Item{
text: data,
index: uint32(index),
@@ -104,7 +104,7 @@ func Run(options *Options) {
colors: nil,
rank: Rank{0, 0, uint32(index)}}
- trimmed, colors := extractColors(item.text)
+ trimmed, colors := ansiProcessor(item.text)
item.text = trimmed
item.colors = colors
return &item