The statusbar got lost somewhere along the way. A noisy (debug) log message was left in.

This commit is contained in:
Sean E. Russell 2021-01-26 13:09:10 -06:00
parent f56cc6486f
commit 273f572a87
2 changed files with 6 additions and 8 deletions

View File

@ -51,7 +51,6 @@ var (
conf gotop.Config conf gotop.Config
help *w.HelpMenu help *w.HelpMenu
bar *w.StatusBar bar *w.StatusBar
statusbar bool
stderrLogger = log.New(os.Stderr, "", 0) stderrLogger = log.New(os.Stderr, "", 0)
tr lingo.Translations tr lingo.Translations
) )
@ -176,7 +175,7 @@ func eventLoop(c gotop.Config, grid *layout.MyGrid) {
case <-drawTicker: case <-drawTicker:
if !c.HelpVisible { if !c.HelpVisible {
ui.Render(grid) ui.Render(grid)
if statusbar { if c.Statusbar {
ui.Render(bar) ui.Render(bar)
} }
} }
@ -193,7 +192,7 @@ func eventLoop(c gotop.Config, grid *layout.MyGrid) {
case "<Resize>": case "<Resize>":
payload := e.Payload.(ui.Resize) payload := e.Payload.(ui.Resize)
termWidth, termHeight := payload.Width, payload.Height termWidth, termHeight := payload.Width, payload.Height
if statusbar { if c.Statusbar {
grid.SetRect(0, 0, termWidth, termHeight-1) grid.SetRect(0, 0, termWidth, termHeight-1)
bar.SetRect(0, termHeight-1, termWidth, termHeight) bar.SetRect(0, termHeight-1, termWidth, termHeight)
} else { } else {
@ -238,7 +237,7 @@ func eventLoop(c gotop.Config, grid *layout.MyGrid) {
} }
case "<Resize>": case "<Resize>":
ui.Render(grid) ui.Render(grid)
if statusbar { if c.Statusbar {
ui.Render(bar) ui.Render(bar)
} }
case "<MouseLeft>": case "<MouseLeft>":
@ -433,7 +432,7 @@ func run() int {
setDefaultTermuiColors(conf) // done before initializing widgets to allow inheriting colors setDefaultTermuiColors(conf) // done before initializing widgets to allow inheriting colors
help = w.NewHelpMenu(tr) help = w.NewHelpMenu(tr)
if statusbar { if conf.Statusbar {
bar = w.NewStatusBar() bar = w.NewStatusBar()
} }
@ -444,7 +443,7 @@ func run() int {
} }
termWidth, termHeight := ui.TerminalDimensions() termWidth, termHeight := ui.TerminalDimensions()
if statusbar { if conf.Statusbar {
grid.SetRect(0, 0, termWidth, termHeight-1) grid.SetRect(0, 0, termWidth, termHeight-1)
} else { } else {
grid.SetRect(0, 0, termWidth, termHeight) grid.SetRect(0, 0, termWidth, termHeight)
@ -452,7 +451,7 @@ func run() int {
help.Resize(termWidth, termHeight) help.Resize(termWidth, termHeight)
ui.Render(grid) ui.Render(grid)
if statusbar { if conf.Statusbar {
bar.SetRect(0, termHeight-1, termWidth, termHeight) bar.SetRect(0, termHeight-1, termWidth, termHeight)
ui.Render(bar) ui.Render(bar)
} }

View File

@ -19,7 +19,6 @@ func getProcs() ([]Proc, error) {
procs := []Proc{} procs := []Proc{}
for _, line := range linesOfProcStrings { for _, line := range linesOfProcStrings {
log.Printf("line is '%s', pid is '%s', cpu is '%s', mem is '%s'", line, strings.TrimSpace(line[0:10]), strings.TrimSpace(line[63:68]), strings.TrimSpace(line[69:74]))
pid, err := strconv.Atoi(strings.TrimSpace(line[0:10])) pid, err := strconv.Atoi(strings.TrimSpace(line[0:10]))
if err != nil { if err != nil {
log.Println(tr.Value("widget.proc.err.pidconv", err.Error(), line)) log.Println(tr.Value("widget.proc.err.pidconv", err.Error(), line))