mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-21 23:01:03 +00:00
fix issue with padding colored strings
This commit is contained in:
parent
2d858955e6
commit
d0fffd8bca
1 changed files with 3 additions and 2 deletions
|
|
@ -30,10 +30,11 @@ func SplitLines(multilineString string) []string {
|
|||
|
||||
// WithPadding pads a string as much as you want
|
||||
func WithPadding(str string, padding int) string {
|
||||
if padding-len(str) < 0 {
|
||||
uncoloredStr := Decolorise(str)
|
||||
if padding < len(uncoloredStr) {
|
||||
return str
|
||||
}
|
||||
return str + strings.Repeat(" ", padding-len(str))
|
||||
return str + strings.Repeat(" ", padding-len(uncoloredStr))
|
||||
}
|
||||
|
||||
// ColoredString takes a string and a colour attribute and returns a colored
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue