app.go 329 B

123456789101112131415
  1. package ui
  2. import (
  3. "github.com/gdamore/tcell/v2"
  4. "github.com/rivo/tview"
  5. )
  6. // NewApp creates and returns a new application.
  7. func NewApp(onAppInputCapture func(*tcell.EventKey) *tcell.EventKey) (app *tview.Application) {
  8. app = tview.NewApplication().
  9. EnableMouse(true).
  10. SetInputCapture(onAppInputCapture)
  11. return app
  12. }