Fix position bounds and spacing logic in Zukitchi widget rendering
This commit is contained in:
parent
21ac083ef0
commit
915087d31a
@ -77,13 +77,13 @@ func cutFirstAndListLineAndMove(frame string, position int) string {
|
|||||||
if position < 0 {
|
if position < 0 {
|
||||||
position = 0
|
position = 0
|
||||||
}
|
}
|
||||||
if position > 35 {
|
if position > 34 {
|
||||||
position = 35
|
position = 34
|
||||||
}
|
}
|
||||||
lines := strings.Split(frame, "\n")
|
lines := strings.Split(frame, "\n")
|
||||||
result := make([]string, 0, len(lines))
|
result := make([]string, 0, len(lines))
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
result = append(result, strings.Repeat(" ", position)+line+strings.Repeat(" ", 36-position))
|
result = append(result, strings.Repeat(" ", position)+line+strings.Repeat(" ", 35-position))
|
||||||
}
|
}
|
||||||
return strings.Join(result[1:len(result)-1], "\n")
|
return strings.Join(result[1:len(result)-1], "\n")
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user