mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-03-31 22:22:14 +02:00
fix yet another issue with indentation
This commit is contained in:
parent
6457800748
commit
b04b457246
@ -9,10 +9,11 @@ import (
|
||||
// WithPadding pads a string as much as you want
|
||||
func WithPadding(str string, padding int) string {
|
||||
uncoloredStr := Decolorise(str)
|
||||
if padding < len(uncoloredStr) {
|
||||
width := runewidth.StringWidth(uncoloredStr)
|
||||
if padding < width {
|
||||
return str
|
||||
}
|
||||
return str + strings.Repeat(" ", padding-len(uncoloredStr))
|
||||
return str + strings.Repeat(" ", padding-width)
|
||||
}
|
||||
|
||||
func RenderDisplayStrings(displayStringsArr [][]string) string {
|
||||
@ -55,9 +56,9 @@ func getPadWidths(stringArrays [][]string) []int {
|
||||
padWidths := make([]int, maxWidth-1)
|
||||
for i := range padWidths {
|
||||
for _, strings := range stringArrays {
|
||||
uncoloredString := Decolorise(strings[i])
|
||||
uncoloredStr := Decolorise(strings[i])
|
||||
|
||||
width := runewidth.StringWidth(uncoloredString)
|
||||
width := runewidth.StringWidth(uncoloredStr)
|
||||
if width > padWidths[i] {
|
||||
padWidths[i] = width
|
||||
}
|
||||
|
@ -25,6 +25,11 @@ func TestWithPadding(t *testing.T) {
|
||||
14,
|
||||
"hello world ! ",
|
||||
},
|
||||
{
|
||||
"Güçlü",
|
||||
7,
|
||||
"Güçlü ",
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
|
Loading…
x
Reference in New Issue
Block a user