mirror of
https://github.com/br0xen/termbox-util.git
synced 2024-11-22 13:33:15 +00:00
Some Tweaking
This commit is contained in:
parent
c581974cc0
commit
4b7d3032c8
@ -136,7 +136,7 @@ func (i *InputModal) Draw() {
|
||||
}
|
||||
if i.text != "" {
|
||||
DrawStringAtPoint(i.text, i.x+1, next_y, i.fg, i.bg)
|
||||
next_y += 2
|
||||
next_y += 1
|
||||
}
|
||||
i.input.SetY(next_y)
|
||||
i.input.Draw()
|
||||
|
@ -49,10 +49,14 @@ func AlignText(txt string, width int, align TextAlignment) string {
|
||||
num_spaces := width - len(txt)
|
||||
switch align {
|
||||
case ALIGN_CENTER:
|
||||
return fmt.Sprintf("%s%s%s",
|
||||
strings.Repeat(" ", num_spaces/2),
|
||||
txt, strings.Repeat(" ", num_spaces/2),
|
||||
)
|
||||
if num_spaces/2 > 0 {
|
||||
return fmt.Sprintf("%s%s%s",
|
||||
strings.Repeat(" ", num_spaces/2),
|
||||
txt, strings.Repeat(" ", num_spaces/2),
|
||||
)
|
||||
} else {
|
||||
return txt
|
||||
}
|
||||
case ALIGN_RIGHT:
|
||||
return fmt.Sprintf("%s%s", strings.Repeat(" ", num_spaces), txt)
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user