textviews.go 522 B

123456789101112131415161718192021222324
  1. package ui
  2. import (
  3. "github.com/gdamore/tcell/v2"
  4. "github.com/rigormorrtiss/discordo/util"
  5. "github.com/rivo/tview"
  6. )
  7. func NewMessagesTextView(app *tview.Application, theme *util.Theme) (textV *tview.TextView) {
  8. textV = tview.NewTextView()
  9. textV.
  10. SetDynamicColors(true).
  11. SetWordWrap(true).
  12. ScrollToEnd().
  13. SetChangedFunc(func() {
  14. app.Draw()
  15. }).
  16. SetBackgroundColor(tcell.GetColor(theme.TextViewBackground)).
  17. SetBorder(true).
  18. SetBorderPadding(0, 0, 1, 0).
  19. SetTitleAlign(tview.AlignLeft)
  20. return
  21. }