| 1 |
package vt |
| 2 |
|
| 3 |
import ( |
| 4 |
"image/color" |
| 5 |
|
| 6 |
uv "github.com/charmbracelet/ultraviolet" |
| 7 |
"github.com/charmbracelet/x/ansi" |
| 8 |
) |
| 9 |
|
| 10 |
// Callbacks represents a set of callbacks for a terminal. |
| 11 |
type Callbacks struct { |
| 12 |
// Bell callback. When set, this function is called when a bell character is |
| 13 |
// received. |
| 14 |
Bell func() |
| 15 |
|
| 16 |
// Title callback. When set, this function is called when the terminal title |
| 17 |
// changes. |
| 18 |
Title func(string) |
| 19 |
|
| 20 |
// IconName callback. When set, this function is called when the terminal |
| 21 |
// icon name changes. |
| 22 |
IconName func(string) |
| 23 |
|
| 24 |
// AltScreen callback. When set, this function is called when the alternate |
| 25 |
// screen is activated or deactivated. |
| 26 |
AltScreen func(bool) |
| 27 |
|
| 28 |
// CursorPosition callback. When set, this function is called when the cursor |
| 29 |
// position changes. |
| 30 |
CursorPosition func(old, new uv.Position) //nolint:predeclared,revive |
| 31 |
|
| 32 |
// CursorVisibility callback. When set, this function is called when the |
| 33 |
// cursor visibility changes. |
| 34 |
CursorVisibility func(visible bool) |
| 35 |
|
| 36 |
// CursorStyle callback. When set, this function is called when the cursor |
| 37 |
// style changes. |
| 38 |
CursorStyle func(style CursorStyle, blink bool) |
| 39 |
|
| 40 |
// CursorColor callback. When set, this function is called when the cursor |
| 41 |
// color changes. Nil indicates the default terminal color. |
| 42 |
CursorColor func(color color.Color) |
| 43 |
|
| 44 |
// BackgroundColor callback. When set, this function is called when the |
| 45 |
// background color changes. Nil indicates the default terminal color. |
| 46 |
BackgroundColor func(color color.Color) |
| 47 |
|
| 48 |
// ForegroundColor callback. When set, this function is called when the |
| 49 |
// foreground color changes. Nil indicates the default terminal color. |
| 50 |
ForegroundColor func(color color.Color) |
| 51 |
|
| 52 |
// WorkingDirectory callback. When set, this function is called when the |
| 53 |
// current working directory changes. |
| 54 |
WorkingDirectory func(string) |
| 55 |
|
| 56 |
// EnableMode callback. When set, this function is called when a mode is |
| 57 |
// enabled. |
| 58 |
EnableMode func(mode ansi.Mode) |
| 59 |
|
| 60 |
// DisableMode callback. When set, this function is called when a mode is |
| 61 |
// disabled. |
| 62 |
DisableMode func(mode ansi.Mode) |
| 63 |
} |