textviews.go 488 B

1234567891011121314151617181920212223
  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, 1)
  19. return
  20. }