Skip to content

Commit

Permalink
Use a callback to signal exiting the buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
moncho committed Jul 18, 2018
1 parent 36be1a9 commit 195b52d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions appui/less.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ import (
)

//Less renders the given renderer output in a "less" buffer
func Less(renderer ui.Renderer, screen *ui.Screen, keyboardQueue chan termbox.Event, closeView chan struct{}) {
defer func() {
closeView <- struct{}{}
}()
func Less(renderer ui.Renderer, screen *ui.Screen, events <-chan termbox.Event, onDone func()) {
defer onDone()
screen.ClearAndFlush()

less := ui.NewLess(screen, DryTheme)
less.MarkupSupport()
io.WriteString(less, renderer.Render())

//Focus blocks until less decides that it does not want focus any more
less.Focus(keyboardQueue)
less.Focus(events)
termbox.HideCursor()
screen.ClearAndFlush()

Expand Down

0 comments on commit 195b52d

Please sign in to comment.