%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/waritko/go/src/github.com/cheggaaa/pb/
Upload File :
Create Path :
Current File : //home/waritko/go/src/github.com/cheggaaa/pb/runecount.go

package pb

import (
	"github.com/mattn/go-runewidth"
	"regexp"
)

// Finds the control character sequences (like colors)
var ctrlFinder = regexp.MustCompile("\x1b\x5b[0-9]+\x6d")

func escapeAwareRuneCountInString(s string) int {
	n := runewidth.StringWidth(s)
	for _, sm := range ctrlFinder.FindAllString(s, -1) {
		n -= runewidth.StringWidth(sm)
	}
	return n
}

Zerion Mini Shell 1.0