Fix rendering when horizontally joining a block with a height of 2

This commit is contained in:
Christian Rocha 2021-03-24 21:31:57 -04:00
parent 56a9250443
commit ae5db7b9f8
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018

View File

@ -92,21 +92,14 @@ func JoinHorizontal(pos float64, strs ...string) string {
// Merge lines
var b strings.Builder
var done bool
for i := range blocks[0] { // remember, all blocks have the same number of members now
for j, block := range blocks {
b.WriteString(block[i])
// Also make lines the same length
b.WriteString(strings.Repeat(" ", maxWidths[j]-ansi.PrintableRuneWidth(block[i])))
if j == len(block)-1 {
done = true
}
}
if !done {
b.WriteRune('\n')
}
b.WriteRune('\n')
}
return b.String()