mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
prepopulate filter input with current filter, add esc handler
This commit is contained in:
parent
06c4b24212
commit
ca61ec712e
5
menus.go
5
menus.go
@ -39,6 +39,7 @@ func FilterMenu() {
|
|||||||
i := widgets.NewInput()
|
i := widgets.NewInput()
|
||||||
i.BorderLabel = "Filter"
|
i.BorderLabel = "Filter"
|
||||||
i.SetY(ui.TermHeight() - i.Height)
|
i.SetY(ui.TermHeight() - i.Height)
|
||||||
|
i.Data = config.GetVal("filterStr")
|
||||||
ui.Render(i)
|
ui.Render(i)
|
||||||
|
|
||||||
// refresh container rows on input
|
// refresh container rows on input
|
||||||
@ -52,6 +53,10 @@ func FilterMenu() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
i.InputHandlers()
|
i.InputHandlers()
|
||||||
|
ui.Handle("/sys/kbd/<escape>", func(ui.Event) {
|
||||||
|
config.Update("filterStr", "")
|
||||||
|
ui.StopLoop()
|
||||||
|
})
|
||||||
ui.Handle("/sys/kbd/<enter>", func(ui.Event) {
|
ui.Handle("/sys/kbd/<enter>", func(ui.Event) {
|
||||||
config.Update("filterStr", i.Data)
|
config.Update("filterStr", i.Data)
|
||||||
ui.StopLoop()
|
ui.StopLoop()
|
||||||
|
Loading…
Reference in New Issue
Block a user