2020-06-05 12:40:44 -04:00
|
|
|
package tea
|
|
|
|
|
2021-05-07 15:11:57 -04:00
|
|
|
// renderer is the interface for Bubble Tea renderers.
|
2021-02-09 13:33:25 -05:00
|
|
|
type renderer interface {
|
2021-05-19 21:35:36 -04:00
|
|
|
// Start the renderer.
|
2021-02-09 13:33:25 -05:00
|
|
|
start()
|
2021-05-19 21:35:36 -04:00
|
|
|
|
|
|
|
// Stop the renderer, but render the final frame in the buffer, if any.
|
2021-02-09 13:33:25 -05:00
|
|
|
stop()
|
2021-05-19 21:35:36 -04:00
|
|
|
|
|
|
|
// Stop the renderer without doing any final rendering.
|
|
|
|
kill()
|
|
|
|
|
2021-08-23 17:16:59 -04:00
|
|
|
// Write a frame to the renderer. The renderer can write this data to
|
|
|
|
// output at its discretion.
|
2021-02-09 13:33:25 -05:00
|
|
|
write(string)
|
2021-05-19 21:35:36 -04:00
|
|
|
|
2022-04-12 10:23:10 -04:00
|
|
|
// Request a full re-render. Note that this will not trigger a render
|
|
|
|
// immediately. Rather, this method causes the next render to be a full
|
|
|
|
// repaint. Because of this, it's safe to call this method multiple times
|
|
|
|
// in succession.
|
2021-05-28 21:41:42 -04:00
|
|
|
repaint()
|
2021-05-19 21:35:36 -04:00
|
|
|
|
2022-08-25 13:13:30 -04:00
|
|
|
// Clears the terminal.
|
|
|
|
clearScreen()
|
|
|
|
|
2021-05-19 21:35:36 -04:00
|
|
|
// Whether or not the alternate screen buffer is enabled.
|
2021-02-09 13:33:25 -05:00
|
|
|
altScreen() bool
|
2022-10-03 18:04:05 -04:00
|
|
|
// Enable the alternate screen buffer.
|
|
|
|
enterAltScreen()
|
|
|
|
// Disable the alternate screen buffer.
|
|
|
|
exitAltScreen()
|
|
|
|
|
|
|
|
// Show the cursor.
|
|
|
|
showCursor()
|
|
|
|
// Hide the cursor.
|
|
|
|
hideCursor()
|
|
|
|
|
|
|
|
// enableMouseCellMotion enables mouse click, release, wheel and motion
|
|
|
|
// events if a mouse button is pressed (i.e., drag events).
|
|
|
|
enableMouseCellMotion()
|
|
|
|
|
2023-12-04 11:50:59 -05:00
|
|
|
// disableMouseCellMotion disables Mouse Cell Motion tracking.
|
2022-10-03 18:04:05 -04:00
|
|
|
disableMouseCellMotion()
|
|
|
|
|
2023-12-04 11:50:59 -05:00
|
|
|
// enableMouseAllMotion enables mouse click, release, wheel and motion
|
2022-10-03 18:04:05 -04:00
|
|
|
// events, regardless of whether a mouse button is pressed. Many modern
|
|
|
|
// terminals support this, but not all.
|
|
|
|
enableMouseAllMotion()
|
|
|
|
|
2023-12-04 11:50:59 -05:00
|
|
|
// disableMouseAllMotion disables All Motion mouse tracking.
|
2022-10-03 18:04:05 -04:00
|
|
|
disableMouseAllMotion()
|
2023-12-04 11:50:59 -05:00
|
|
|
|
|
|
|
// enableMouseSGRMode enables mouse extended mode (SGR).
|
|
|
|
enableMouseSGRMode()
|
|
|
|
|
|
|
|
// disableMouseSGRMode disables mouse extended mode (SGR).
|
|
|
|
disableMouseSGRMode()
|
2020-06-17 18:43:01 -04:00
|
|
|
}
|
2022-04-12 10:23:10 -04:00
|
|
|
|
|
|
|
// repaintMsg forces a full repaint.
|
|
|
|
type repaintMsg struct{}
|