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