Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/inspect' into inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
stokito committed Nov 24, 2020
2 parents 6a1df0c + 71ab2c9 commit 09ffe45
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions menus.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,34 @@ func InspectView() MenuFn {
return nil
}

func InspectView() MenuFn {
c := cursor.Selected()
if c == nil {
return nil
}

ui.DefaultEvtStream.ResetHandlers()
defer ui.DefaultEvtStream.ResetHandlers()

inspectLines, quit := inspectReader(c)
m := widgets.NewTextView(inspectLines)
m.BorderLabel = fmt.Sprintf("Inspect [%s]", c.GetMeta("name"))
ui.Render(m)

ui.Handle("/sys/wnd/resize", func(e ui.Event) {
m.Resize()
})
ui.Handle("/sys/kbd/t", func(ui.Event) {
m.Toggle()
})
ui.Handle("/sys/kbd/q", func(ui.Event) {
quit <- true
ui.StopLoop()
})
ui.Loop()
return nil
}

// Create a confirmation dialog with a given description string and
// func to perform if confirmed
func Confirm(txt string, fn func()) MenuFn {
Expand Down

0 comments on commit 09ffe45

Please sign in to comment.