From a7c9949dafb72f201aed24ae2668bce27e0bc809 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" Date: Fri, 14 Feb 2020 07:00:39 -0600 Subject: Fixes rowspan losing widget bug. Preps for 3.2.0 --- CHANGELOG.md | 6 ++++++ cmd/gotop/main.go | 2 +- layout/layout.go | 14 ++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87beac6..4b0e9d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 > - **Fixed**: for any bug fixes. > - **Security**: in case of vulnerabilities. +## [3.2.0] - + +Bug fixes & pull requests + +- FIX Rowspan in a column loses widgets in later columns + ## [3.1.0] - 2020-02-13 Re-homed the project after the original fork (trunk?) was marked as diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index 0634564..1ef42d4 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -26,7 +26,7 @@ import ( const ( appName = "gotop" - version = "3.1.0" + version = "3.1.1" graphHorizontalScaleDelta = 3 defaultUI = "cpu\ndisk/1 2:mem/2\ntemp\nnet procs" 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 + } } } } -- cgit v1.2.3