renderer.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package tea
  2. // renderer is the interface for Bubble Tea renderers.
  3. type renderer interface {
  4. // Start the renderer.
  5. start()
  6. // Stop the renderer, but render the final frame in the buffer, if any.
  7. stop()
  8. // Stop the renderer without doing any final rendering.
  9. kill()
  10. // Write a frame to the renderer. The renderer can write this data to
  11. // output at its discretion.
  12. write(string)
  13. // Request a full re-render. Note that this will not trigger a render
  14. // immediately. Rather, this method causes the next render to be a full
  15. // repaint. Because of this, it's safe to call this method multiple times
  16. // in succession.
  17. repaint()
  18. // Clears the terminal.
  19. clearScreen()
  20. // Whether or not the alternate screen buffer is enabled.
  21. altScreen() bool
  22. // Enable the alternate screen buffer.
  23. enterAltScreen()
  24. // Disable the alternate screen buffer.
  25. exitAltScreen()
  26. // Show the cursor.
  27. showCursor()
  28. // Hide the cursor.
  29. hideCursor()
  30. // enableMouseCellMotion enables mouse click, release, wheel and motion
  31. // events if a mouse button is pressed (i.e., drag events).
  32. enableMouseCellMotion()
  33. // DisableMouseCellMotion disables Mouse Cell Motion tracking.
  34. disableMouseCellMotion()
  35. // EnableMouseAllMotion enables mouse click, release, wheel and motion
  36. // events, regardless of whether a mouse button is pressed. Many modern
  37. // terminals support this, but not all.
  38. enableMouseAllMotion()
  39. // DisableMouseAllMotion disables All Motion mouse tracking.
  40. disableMouseAllMotion()
  41. }
  42. // repaintMsg forces a full repaint.
  43. type repaintMsg struct{}