diff --git a/termbox_confirmmodal.go b/termbox_confirmmodal.go index 632663d..61d2483 100644 --- a/termbox_confirmmodal.go +++ b/termbox_confirmmodal.go @@ -124,8 +124,10 @@ func (i *ConfirmModal) Draw() { DrawStringAtPoint(i.text, i.x+1, next_y, i.fg, i.bg) next_y += 1 } - next_y += 3 + next_y += 2 if i.show_help { - DrawStringAtPoint("(Y/y) Confirm. (N/n) Reject.", i.x+1, next_y, i.fg, i.bg) + help_string := " (Y/y) Confirm. (N/n) Reject. " + help_x := (i.x + i.width) - len(help_string) - 1 + DrawStringAtPoint(help_string, help_x, next_y, i.fg, i.bg) } } diff --git a/termbox_inputmodal.go b/termbox_inputmodal.go index 61f911e..62aff5a 100644 --- a/termbox_inputmodal.go +++ b/termbox_inputmodal.go @@ -105,6 +105,7 @@ func (i *InputModal) HandleKeyPress(event termbox.Event) bool { return i.input.HandleKeyPress(event) } } + func (i *InputModal) Draw() { // First blank out the area we'll be putting the modal FillWithChar(' ', i.x, i.y, i.x+i.width, i.y+i.height, i.fg, i.bg) @@ -121,12 +122,14 @@ func (i *InputModal) Draw() { } if i.text != "" { DrawStringAtPoint(i.text, i.x+1, next_y, i.fg, i.bg) - next_y += 1 + next_y += 2 } i.input.SetY(next_y) i.input.Draw() next_y += 3 if i.show_help { - DrawStringAtPoint("(ENTER) to Accept. (ESC) to Cancel.", i.x+1, next_y, i.fg, i.bg) + help_string := " (ENTER) to Accept. (ESC) to Cancel. " + help_x := (i.x + i.width - len(help_string)) - 1 + DrawStringAtPoint(help_string, help_x, next_y, i.fg, i.bg) } } diff --git a/termbox_util.go b/termbox_util.go index 3f6c25b..01b39d3 100644 --- a/termbox_util.go +++ b/termbox_util.go @@ -33,10 +33,16 @@ func FillWithChar(r rune, x1, y1, x2, y2 int, fg termbox.Attribute, bg termbox.A } func DrawBorder(x1, y1, x2, y2 int, fg termbox.Attribute, bg termbox.Attribute) { - FillWithChar('|', x1, y1, x1, y2, fg, bg) - FillWithChar('|', x2, y1, x2, y2, fg, bg) - FillWithChar('-', x1, y1, x2, y1, fg, bg) - FillWithChar('-', x1, y2, x2, y2, fg, bg) + termbox.SetCell(x1, y1, '┌', fg, bg) + FillWithChar('─', x1+1, y1, x2-1, y1, fg, bg) + termbox.SetCell(x2, y1, '┐', fg, bg) + + FillWithChar('|', x1, y1+1, x1, y2-1, fg, bg) + FillWithChar('|', x2, y1+1, x2, y2-1, fg, bg) + + termbox.SetCell(x1, y2, '└', fg, bg) + FillWithChar('─', x1+1, y2, x2-1, y2, fg, bg) + termbox.SetCell(x2, y2, '┘', fg, bg) } func AlignText(txt string, width int, align TextAlignment) string {