Code cleanup

This commit is contained in:
Junegunn Choi
2015-03-22 16:05:54 +09:00
parent d94dfe0876
commit b431e227da
9 changed files with 51 additions and 54 deletions

View File

@@ -7,7 +7,7 @@ import (
"strings"
)
type AnsiOffset struct {
type ansiOffset struct {
offset [2]int32
color ansiState
}
@@ -35,8 +35,8 @@ func init() {
ansiRegex = regexp.MustCompile("\x1b\\[[0-9;]*m")
}
func ExtractColor(str *string) (*string, []AnsiOffset) {
offsets := make([]AnsiOffset, 0)
func extractColor(str *string) (*string, []ansiOffset) {
var offsets []ansiOffset
var output bytes.Buffer
var state *ansiState
@@ -56,7 +56,7 @@ func ExtractColor(str *string) (*string, []AnsiOffset) {
if newState.colored() {
// Append new offset
state = newState
offsets = append(offsets, AnsiOffset{[2]int32{newLen, newLen}, *state})
offsets = append(offsets, ansiOffset{[2]int32{newLen, newLen}, *state})
} else {
// Discard state
state = nil