aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/MichaelMure/go-term-text/trim.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/MichaelMure/go-term-text/trim.go')
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/trim.go28
1 files changed, 0 insertions, 28 deletions
diff --git a/vendor/github.com/MichaelMure/go-term-text/trim.go b/vendor/github.com/MichaelMure/go-term-text/trim.go
deleted file mode 100644
index eaf2ca0c..00000000
--- a/vendor/github.com/MichaelMure/go-term-text/trim.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package text
-
-import (
- "strings"
- "unicode"
-)
-
-// TrimSpace remove the leading and trailing whitespace while ignoring the
-// terminal escape sequences.
-// Returns the number of trimmed space on both side.
-func TrimSpace(line string) string {
- cleaned, escapes := ExtractTermEscapes(line)
-
- // trim left while counting
- left := 0
- trimmed := strings.TrimLeftFunc(cleaned, func(r rune) bool {
- if unicode.IsSpace(r) {
- left++
- return true
- }
- return false
- })
-
- trimmed = strings.TrimRightFunc(trimmed, unicode.IsSpace)
-
- escapes = OffsetEscapes(escapes, -left)
- return ApplyTermEscapes(trimmed, escapes)
-}