diff options
author | Sean E. Russell <ser@ser1.net> | 2020-02-14 07:00:39 -0600 |
---|---|---|
committer | Sean E. Russell <ser@ser1.net> | 2020-02-14 07:00:39 -0600 |
commit | a7c9949dafb72f201aed24ae2668bce27e0bc809 (patch) | |
tree | 8c1c4275d020633392a6924f1a68bfc5c3b8f542 /layout | |
parent | eb27f7413185494d81f0293f55b9064179adb278 (diff) |
Fixes rowspan losing widget bug. Preps for 3.2.0
Diffstat (limited to 'layout')
-rw-r--r-- | layout/layout.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/layout/layout.go b/layout/layout.go index 7bafc9f..c78bb67 100644 --- a/layout/layout.go +++ b/layout/layout.go @@ -29,7 +29,6 @@ type MyGrid struct { var widgetNames []string = []string{"cpu", "disk", "mem", "temp", "net", "procs", "batt"} -// FIXME 2:disk mem\nnet loses the widget from the second line func Layout(wl layout, c gotop.Config) (*MyGrid, error) { rowDefs := wl.Rows uiRows := make([]ui.GridItem, 0) @@ -88,11 +87,14 @@ func processRow(c gotop.Config, numRows int, rowDefs [][]widgetRule) (ui.GridIte } colHeights := make([]int, numCols) for _, rds := range processing { - for i, rd := range rds { - if colHeights[i]+rd.Height <= maxHeight { - widget := makeWidget(c, rd) - columns[i] = append(columns[i], ui.NewRow(float64(rd.Height)/float64(maxHeight), widget)) - colHeights[i] += rd.Height + for _, rd := range rds { + for j, ch := range colHeights { + if ch+rd.Height <= maxHeight { + widget := makeWidget(c, rd) + columns[j] = append(columns[j], ui.NewRow(float64(rd.Height)/float64(maxHeight), widget)) + colHeights[j] += rd.Height + break + } } } } |