Fixes rowspan losing widget bug. Preps for 3.2.0

This commit is contained in:
Sean E. Russell 2020-02-14 07:00:39 -06:00
parent eb27f74131
commit a7c9949daf
3 changed files with 15 additions and 7 deletions

View File

@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
> - **Fixed**: for any bug fixes. > - **Fixed**: for any bug fixes.
> - **Security**: in case of vulnerabilities. > - **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 ## [3.1.0] - 2020-02-13
Re-homed the project after the original fork (trunk?) was marked as Re-homed the project after the original fork (trunk?) was marked as

View File

@ -26,7 +26,7 @@ import (
const ( const (
appName = "gotop" appName = "gotop"
version = "3.1.0" version = "3.1.1"
graphHorizontalScaleDelta = 3 graphHorizontalScaleDelta = 3
defaultUI = "cpu\ndisk/1 2:mem/2\ntemp\nnet procs" defaultUI = "cpu\ndisk/1 2:mem/2\ntemp\nnet procs"

View File

@ -29,7 +29,6 @@ type MyGrid struct {
var widgetNames []string = []string{"cpu", "disk", "mem", "temp", "net", "procs", "batt"} 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) { func Layout(wl layout, c gotop.Config) (*MyGrid, error) {
rowDefs := wl.Rows rowDefs := wl.Rows
uiRows := make([]ui.GridItem, 0) uiRows := make([]ui.GridItem, 0)
@ -88,11 +87,14 @@ func processRow(c gotop.Config, numRows int, rowDefs [][]widgetRule) (ui.GridIte
} }
colHeights := make([]int, numCols) colHeights := make([]int, numCols)
for _, rds := range processing { for _, rds := range processing {
for i, rd := range rds { for _, rd := range rds {
if colHeights[i]+rd.Height <= maxHeight { for j, ch := range colHeights {
widget := makeWidget(c, rd) if ch+rd.Height <= maxHeight {
columns[i] = append(columns[i], ui.NewRow(float64(rd.Height)/float64(maxHeight), widget)) widget := makeWidget(c, rd)
colHeights[i] += rd.Height columns[j] = append(columns[j], ui.NewRow(float64(rd.Height)/float64(maxHeight), widget))
colHeights[j] += rd.Height
break
}
} }
} }
} }