Skip to content
Snippets Groups Projects
Commit 8044edd0 authored by Hans Moog's avatar Hans Moog
Browse files

Fix: fixed crashing statusscreen + wrong indentation

parent 9eaead50
No related branches found
No related tags found
No related merge requests found
...@@ -58,6 +58,9 @@ func run(plugin *node.Plugin) { ...@@ -58,6 +58,9 @@ func run(plugin *node.Plugin) {
content := tview.NewGrid() content := tview.NewGrid()
content.SetBackgroundColor(tcell.ColorWhite) content.SetBackgroundColor(tcell.ColorWhite)
content.SetColumns(0) content.SetColumns(0)
content.SetBorders(false)
content.SetOffset(0, 0)
content.SetGap(0, 0)
footer := newPrimitive("") footer := newPrimitive("")
footer.SetBackgroundColor(tcell.ColorDarkMagenta) footer.SetBackgroundColor(tcell.ColorDarkMagenta)
...@@ -88,8 +91,9 @@ func run(plugin *node.Plugin) { ...@@ -88,8 +91,9 @@ func run(plugin *node.Plugin) {
app.SetBeforeDrawFunc(func(screen tcell.Screen) bool { app.SetBeforeDrawFunc(func(screen tcell.Screen) bool {
headerBar.Update() headerBar.Update()
rows := make([]int, 1) rows := make([]int, 2)
rows[0] = 1 rows[0] = 1
rows[1] = 1
_, _, _, height := content.GetRect() _, _, _, height := content.GetRect()
for i := 0; i < len(messageLog) && i < height-2; i++ { for i := 0; i < len(messageLog) && i < height-2; i++ {
rows = append(rows, 1) rows = append(rows, 1)
...@@ -102,12 +106,21 @@ func run(plugin *node.Plugin) { ...@@ -102,12 +106,21 @@ func run(plugin *node.Plugin) {
blankLine.SetBackgroundColor(tcell.ColorWhite) blankLine.SetBackgroundColor(tcell.ColorWhite)
content.AddItem(blankLine, 0, 0, 1, 1, 0, 0, false) content.AddItem(blankLine, 0, 0, 1, 1, 0, 0, false)
for i, message := range messageLog[len(messageLog)-len(rows)-1+2:] { logStart := len(messageLog) - (len(rows) - 2)
if logStart < 0 {
logStart = 0
}
for i, message := range messageLog[logStart:] {
if i < height-2 { if i < height-2 {
content.AddItem(NewUILogEntry(*message).Primitive, i+1, 0, 1, 1, 0, 0, false) content.AddItem(NewUILogEntry(*message).Primitive, i+1, 0, 1, 1, 0, 0, false)
} }
} }
blankLine = newPrimitive("")
blankLine.SetBackgroundColor(tcell.ColorWhite)
content.AddItem(blankLine, height-1, 0, 1, 1, 0, 0, false)
return false return false
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment