diff --git a/grid.go b/grid.go index 39bad00..3f9757d 100644 --- a/grid.go +++ b/grid.go @@ -113,12 +113,6 @@ func ResetView() { ui.Clear() } -func OpenMenu(m func()) { - ResetView() - defer ResetView() - m() -} - func (g *Grid) ExpandView() { ResetView() defer ResetView() @@ -195,7 +189,7 @@ func Display(g *Grid) bool { ui.Loop() if menu != nil { - OpenMenu(menu) + menu() return false } if expand { diff --git a/menus.go b/menus.go index 057ff89..366a45b 100644 --- a/menus.go +++ b/menus.go @@ -14,6 +14,9 @@ var helpDialog = []string{ } func HelpMenu() { + ResetView() + defer ResetView() + m := widgets.NewMenu(helpDialog) m.TextFgColor = ui.ColorWhite m.BorderLabel = "Help" @@ -26,10 +29,14 @@ func HelpMenu() { } func FilterMenu() { + ui.DefaultEvtStream.ResetHandlers() + defer ResetView() + i := widgets.NewInput() i.TextFgColor = ui.ColorWhite i.BorderLabel = "Filter" i.BorderFg = ui.ColorCyan + i.SetY(ui.TermHeight() - i.Height) ui.Render(i) i.InputHandlers() ui.Handle("/sys/kbd/", func(ui.Event) { @@ -40,6 +47,9 @@ func FilterMenu() { } func SortMenu() { + ResetView() + defer ResetView() + m := widgets.NewMenu(SortFields()) m.Selectable = true m.TextFgColor = ui.ColorWhite