1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
package gui
import (
"fmt"
"github.com/rivo/tview"
)
type NaviView struct {
*tview.TextView
}
func NewNaviView() *NaviView {
n := &NaviView{
TextView: tview.NewTextView().SetTextAlign(tview.AlignLeft).SetDynamicColors(true),
}
n.SetTitleAlign(tview.AlignLeft)
return n
}
func (n *NaviView) UpdateView(g *Gui) {
g.App.QueueUpdateDraw(func() {
switch g.CurrentPanelKind() {
case InputPanel:
n.SetText(fmt.Sprintf("%s, %s", moveNavi, switchNavi))
case ProcessesPanel:
n.SetText(fmt.Sprintf("%s, %s, %s", moveNavi, switchNavi, helps[ProcessesPanel]))
case ProcessInfoPanel:
n.SetText(fmt.Sprintf("%s, %s, %s", moveNavi, switchNavi, helps[ProcessInfoPanel]))
case ProcessEnvPanel:
n.SetText(fmt.Sprintf("%s, %s, %s", moveNavi, switchNavi, helps[ProcessEnvPanel]))
case ProcessTreePanel:
n.SetText(fmt.Sprintf("%s, %s, %s", moveNavi, switchNavi, helps[ProcessTreePanel]))
case ProcessFilePanel:
n.SetText(fmt.Sprintf("%s, %s, %s", moveNavi, switchNavi, helps[ProcessFilePanel]))
default:
n.SetText("")
}
})
}
var (
moveNavi = "[red::b]j[white]: move down, [red]k[white]: move up, [red]g[white]: move to top, [red]G[white]: move to bottom, [red]Ctrl-f[white]: next page [red]Ctrl-b[white]: previous page, [red]Ctrl-c[white]: stop pst"
switchNavi = `[red::b]Tab[white]: next panel, [red]Shift-Tab[white]: previous panel`
)
var helps = map[int]string{
InputPanel: ``,
ProcessesPanel: `[red]K[white]: kill process`,
ProcessInfoPanel: ``,
ProcessEnvPanel: ``,
ProcessTreePanel: `[red]K[white]: kill process`,
ProcessFilePanel: ``,
}
|