chore: go mod tidy / vendor / make deps
This commit is contained in:
26
vendor/github.com/evertras/bubble-table/table/strlimit.go
generated
vendored
Normal file
26
vendor/github.com/evertras/bubble-table/table/strlimit.go
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
package table
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/muesli/reflow/ansi"
|
||||
"github.com/muesli/reflow/truncate"
|
||||
)
|
||||
|
||||
func limitStr(str string, maxLen int) string {
|
||||
if maxLen == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
newLineIndex := strings.Index(str, "\n")
|
||||
if newLineIndex > -1 {
|
||||
str = str[:newLineIndex] + "…"
|
||||
}
|
||||
|
||||
if ansi.PrintableRuneWidth(str) > maxLen {
|
||||
// #nosec: G115
|
||||
return truncate.StringWithTail(str, uint(maxLen), "…")
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
Reference in New Issue
Block a user