out of range text print fixes

This commit is contained in:
sqshq 2019-02-10 23:06:48 -05:00
parent f8a641d22c
commit f9a73817c3
3 changed files with 10 additions and 11 deletions

View File

@ -52,8 +52,8 @@ runcharts:
x: 0
y: 15
size:
x: 4
y: 4
x: 15
y: 15
- title: MONGO COLLECTIONS COUNT
items:
- label: POSTS

View File

@ -81,7 +81,7 @@ func (l *Layout) HandleConsoleEvent(e string) {
l.menu.idle()
chart := l.getSelectedComponent().Drawable.(*RunChart)
chart.MoveSelection(0)
case MenuOptionExit:
case MenuOptionResume:
l.mode = ModeDefault
l.menu.idle()
}

View File

@ -29,7 +29,7 @@ const (
MenuOptionMove MenuOption = "MOVE"
MenuOptionResize MenuOption = "RESIZE"
MenuOptionPinpoint MenuOption = "PINPOINT"
MenuOptionExit MenuOption = "EXIT"
MenuOptionResume MenuOption = "RESUME"
)
func NewMenu() *Menu {
@ -38,7 +38,7 @@ func NewMenu() *Menu {
block.BorderStyle = ui.NewStyle(console.ColorDarkGrey)
return &Menu{
Block: block,
options: []MenuOption{MenuOptionMove, MenuOptionResize, MenuOptionPinpoint, MenuOptionExit},
options: []MenuOption{MenuOptionMove, MenuOptionResize, MenuOptionPinpoint, MenuOptionResume},
mode: MenuModeIdle,
option: MenuOptionMove,
}
@ -181,7 +181,7 @@ func (m *Menu) printAllDirectionsArrowSign(buffer *ui.Buffer, y int) {
func (m *Menu) renderOptions(buffer *ui.Buffer) {
// TODO extract styles to console.Palette
highlightedStyle := ui.NewStyle(console.ColorWhite, console.ColorClear, ui.ModifierReverse)
highlightedStyle := ui.NewStyle(console.ColorOlive, console.ColorBlack, ui.ModifierReverse)
regularStyle := ui.NewStyle(console.ColorWhite)
offset := 1
@ -194,11 +194,10 @@ func (m *Menu) renderOptions(buffer *ui.Buffer) {
if option != MenuOptionPinpoint || m.component.Type == TypeRunChart {
offset += 2
buffer.SetString(
string(option),
style,
getMiddlePoint(m.Block, string(option), offset-5),
)
point := getMiddlePoint(m.Block, string(option), offset-5)
if point.In(m.GetRect()) {
buffer.SetString(string(option), style, point)
}
}
}
}