Highlight whole room list row even if room name is short
This commit is contained in:
@ -20,6 +20,8 @@ import (
|
||||
"github.com/mattn/go-runewidth"
|
||||
"maunium.net/go/tcell"
|
||||
"maunium.net/go/tview"
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func WriteLineSimple(screen tcell.Screen, line string, x, y int) {
|
||||
@ -57,3 +59,13 @@ func WriteLine(screen tcell.Screen, align int, line string, x, y, maxWidth int,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func WriteLinePadded(screen tcell.Screen, align int, line string, x, y, maxWidth int, style tcell.Style) {
|
||||
padding := strconv.Itoa(maxWidth)
|
||||
if align == tview.AlignRight {
|
||||
line = fmt.Sprintf("%"+padding+"s", line)
|
||||
} else {
|
||||
line = fmt.Sprintf("%-"+padding+"s", line)
|
||||
}
|
||||
WriteLine(screen, tview.AlignLeft, line, x, y, maxWidth, style)
|
||||
}
|
||||
|
Reference in New Issue
Block a user