mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
add SortItems param to Menu, AddItems method
This commit is contained in:
8
menus.go
8
menus.go
@@ -17,10 +17,11 @@ func HelpMenu() {
|
||||
ResetView()
|
||||
defer ResetView()
|
||||
|
||||
m := widgets.NewMenu(helpDialog)
|
||||
m := widgets.NewMenu()
|
||||
m.TextFgColor = ui.ColorWhite
|
||||
m.BorderLabel = "Help"
|
||||
m.BorderFg = ui.ColorCyan
|
||||
m.AddItems(widgets.NewMenuItems(helpDialog)...)
|
||||
ui.Render(m)
|
||||
ui.Handle("/sys/kbd/", func(ui.Event) {
|
||||
ui.StopLoop()
|
||||
@@ -50,12 +51,15 @@ func SortMenu() {
|
||||
ResetView()
|
||||
defer ResetView()
|
||||
|
||||
m := widgets.NewMenu(SortFields())
|
||||
m := widgets.NewMenu()
|
||||
m.Selectable = true
|
||||
m.SortItems = true
|
||||
m.TextFgColor = ui.ColorWhite
|
||||
m.BorderLabel = "Sort Field"
|
||||
m.BorderFg = ui.ColorCyan
|
||||
|
||||
m.AddItems(widgets.NewMenuItems(SortFields())...)
|
||||
|
||||
// set cursor position to current sort field
|
||||
current := config.Get("sortField")
|
||||
for n, item := range m.Items {
|
||||
|
||||
Reference in New Issue
Block a user