summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2020-02-14 07:00:39 -0600
committerSean E. Russell <ser@ser1.net>2020-02-14 07:00:39 -0600
commita7c9949dafb72f201aed24ae2668bce27e0bc809 (patch)
tree8c1c4275d020633392a6924f1a68bfc5c3b8f542
parenteb27f7413185494d81f0293f55b9064179adb278 (diff)
Fixes rowspan losing widget bug. Preps for 3.2.0
-rw-r--r--CHANGELOG.md6
-rw-r--r--cmd/gotop/main.go2
-rw-r--r--layout/layout.go14
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
+ }
}
}
}