diff --git a/widgets/layout.go b/widgets/layout.go index 7f7729d..25c1f10 100644 --- a/widgets/layout.go +++ b/widgets/layout.go @@ -144,6 +144,15 @@ func (l *Layout) HandleConsoleEvent(e string) { } case console.KeyUp: switch l.mode { + case ModeDefault: + l.mode = ModeComponentSelect + l.selection = 0 + l.menu.highlight(l.getComponent(l.selection)) + case ModeComponentSelect: + if l.selection > 0 { + l.selection-- + } + l.menu.highlight(l.getComponent(l.selection)) case ModeMenuOptionSelect: l.menu.up() case ModeComponentMove: @@ -153,6 +162,15 @@ func (l *Layout) HandleConsoleEvent(e string) { } case console.KeyDown: switch l.mode { + case ModeDefault: + l.mode = ModeComponentSelect + l.selection = 0 + l.menu.highlight(l.getComponent(l.selection)) + case ModeComponentSelect: + if l.selection < len(l.components)-1 { + l.selection++ + } + l.menu.highlight(l.getComponent(l.selection)) case ModeMenuOptionSelect: l.menu.down() case ModeComponentMove: diff --git a/widgets/runchart/legend.go b/widgets/runchart/legend.go index b9b45ba..140bb5f 100644 --- a/widgets/runchart/legend.go +++ b/widgets/runchart/legend.go @@ -36,7 +36,7 @@ func (c *RunChart) renderLegend(buffer *ui.Buffer, rectangle image.Rectangle) { height = heightOnDetails } - rowCount := (c.Dx() - yAxisLegendIndent) / (height + yAxisLegendIndent) + rowCount := (c.Dy() - 2*yAxisLegendIndent) / (height + yAxisLegendIndent) columnCount := int(math.Ceil(float64(len(c.lines)) / float64(rowCount))) columnWidth := getColumnWidth(c.mode, c.lines, c.precision) @@ -71,9 +71,9 @@ func (c *RunChart) renderLegend(buffer *ui.Buffer, rectangle image.Rectangle) { details := [4]string{ fmt.Sprintf("cur %s", formatValue(getCurrentValue(line), c.precision)), + fmt.Sprintf("dlt %s", formatValue(getDiffWithPreviousValue(line), c.precision)), fmt.Sprintf("max %s", formatValue(line.extrema.max, c.precision)), fmt.Sprintf("min %s", formatValue(line.extrema.min, c.precision)), - fmt.Sprintf("dif %s", formatValue(getDiffWithPreviousValue(line), c.precision)), } for i, detail := range details {