main
1package tea
2
3// renderer is the interface for Bubble Tea renderers.
4type renderer interface {
5 // Start the renderer.
6 start()
7
8 // Stop the renderer, but render the final frame in the buffer, if any.
9 stop()
10
11 // Stop the renderer without doing any final rendering.
12 kill()
13
14 // Write a frame to the renderer. The renderer can write this data to
15 // output at its discretion.
16 write(string)
17
18 // Request a full re-render. Note that this will not trigger a render
19 // immediately. Rather, this method causes the next render to be a full
20 // repaint. Because of this, it's safe to call this method multiple times
21 // in succession.
22 repaint()
23
24 // Clears the terminal.
25 clearScreen()
26
27 // Whether or not the alternate screen buffer is enabled.
28 altScreen() bool
29 // Enable the alternate screen buffer.
30 enterAltScreen()
31 // Disable the alternate screen buffer.
32 exitAltScreen()
33
34 // Show the cursor.
35 showCursor()
36 // Hide the cursor.
37 hideCursor()
38
39 // enableMouseCellMotion enables mouse click, release, wheel and motion
40 // events if a mouse button is pressed (i.e., drag events).
41 enableMouseCellMotion()
42
43 // disableMouseCellMotion disables Mouse Cell Motion tracking.
44 disableMouseCellMotion()
45
46 // enableMouseAllMotion enables mouse click, release, wheel and motion
47 // events, regardless of whether a mouse button is pressed. Many modern
48 // terminals support this, but not all.
49 enableMouseAllMotion()
50
51 // disableMouseAllMotion disables All Motion mouse tracking.
52 disableMouseAllMotion()
53
54 // enableMouseSGRMode enables mouse extended mode (SGR).
55 enableMouseSGRMode()
56
57 // disableMouseSGRMode disables mouse extended mode (SGR).
58 disableMouseSGRMode()
59
60 // enableBracketedPaste enables bracketed paste, where characters
61 // inside the input are not interpreted when pasted as a whole.
62 enableBracketedPaste()
63
64 // disableBracketedPaste disables bracketed paste.
65 disableBracketedPaste()
66
67 // bracketedPasteActive reports whether bracketed paste mode is
68 // currently enabled.
69 bracketedPasteActive() bool
70
71 // setWindowTitle sets the terminal window title.
72 setWindowTitle(string)
73
74 // reportFocus returns whether reporting focus events is enabled.
75 reportFocus() bool
76
77 // enableReportFocus reports focus events to the program.
78 enableReportFocus()
79
80 // disableReportFocus stops reporting focus events to the program.
81 disableReportFocus()
82}
83
84// repaintMsg forces a full repaint.
85type repaintMsg struct{}