textviews.go 434 B

12345678910111213141516171819202122
  1. package ui
  2. import (
  3. "github.com/rivo/tview"
  4. )
  5. // NewMessagesTextView creates and returns a new messages textview.
  6. func NewMessagesTextView(app *tview.Application) (textV *tview.TextView) {
  7. textV = tview.NewTextView()
  8. textV.
  9. SetDynamicColors(true).
  10. SetWordWrap(true).
  11. ScrollToEnd().
  12. SetChangedFunc(func() {
  13. app.Draw()
  14. }).
  15. SetBorder(true).
  16. SetBorderPadding(0, 0, 1, 0).
  17. SetTitleAlign(tview.AlignLeft)
  18. return
  19. }