renderer.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. // enableMouseSGRMode enables mouse extended mode (SGR).
  42. enableMouseSGRMode()
  43. // disableMouseSGRMode disables mouse extended mode (SGR).
  44. disableMouseSGRMode()
  45. // enableBracketedPaste enables bracketed paste, where characters
  46. // inside the input are not interpreted when pasted as a whole.
  47. enableBracketedPaste()
  48. // disableBracketedPaste disables bracketed paste.
  49. disableBracketedPaste()
  50. // bracketedPasteActive reports whether bracketed paste mode is
  51. // currently enabled.
  52. bracketedPasteActive() bool
  53. // setWindowTitle sets the terminal window title.
  54. setWindowTitle(string)
  55. }
  56. // repaintMsg forces a full repaint.
  57. type repaintMsg struct{}