textviews.go 521 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) *tview.TextView {
  8. messagesTextView := tview.NewTextView()
  9. messagesTextView.
  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, 1)
  19. return messagesTextView
  20. }