Some Tweaking

This commit is contained in:
Brian Buller 2015-05-12 16:05:47 -05:00
parent c581974cc0
commit 4b7d3032c8
2 changed files with 9 additions and 5 deletions

View File

@ -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()

View File

@ -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: