forked from charmbracelet/bubbletea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
renderer.go
37 lines (28 loc) · 881 Bytes
/
renderer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package tea
import "io"
// renderer is the interface for Bubble Tea renderers.
type renderer interface {
// close closes the renderer and flushes any remaining data.
close() error
// render renders a frame to the output.
render(string)
// flush flushes the renderer's buffer to the output.
flush() error
// reset resets the renderer's state to its initial state.
reset()
// update updates the renderer's state with the given message. It returns a
// [tea.Cmd] that can be used to send messages back to the program.
update(Msg)
}
// repaintMsg forces a full repaint.
type repaintMsg struct{}
// rendererWriter is an internal message used to set the output of the renderer.
type rendererWriter struct {
io.Writer
}
// Terminal modes used by SetMode and Mode in Bubble Tea.
const (
graphemeClustering = 2027
altScreenMode = 1049
hideCursor = 25
)