diff options
| author | adamdotdevin <[email protected]> | 2025-07-10 15:49:49 -0500 |
|---|---|---|
| committer | adamdotdevin <[email protected]> | 2025-07-10 15:49:58 -0500 |
| commit | 294d0e7ee3476f4425c3d21fbaf82dfce3aba017 (patch) | |
| tree | 3c24c5caf7075612dc58ff4cdb1b1f87eedc2d9b /packages/tui/input/input.go | |
| parent | 8be1ca836c806c5a3ea3f2f5b49a696063dd3a91 (diff) | |
| download | opencode-294d0e7ee3476f4425c3d21fbaf82dfce3aba017.tar.gz opencode-294d0e7ee3476f4425c3d21fbaf82dfce3aba017.zip | |
fix(tui): mouse wheel ansi codes leaking into editor
Diffstat (limited to 'packages/tui/input/input.go')
| -rw-r--r-- | packages/tui/input/input.go | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/packages/tui/input/input.go b/packages/tui/input/input.go new file mode 100644 index 000000000..da5e4f0be --- /dev/null +++ b/packages/tui/input/input.go @@ -0,0 +1,45 @@ +package input + +import ( + "fmt" + "strings" +) + +// Event represents a terminal event. +type Event any + +// UnknownEvent represents an unknown event. +type UnknownEvent string + +// String returns a string representation of the unknown event. +func (e UnknownEvent) String() string { + return fmt.Sprintf("%q", string(e)) +} + +// MultiEvent represents multiple messages event. +type MultiEvent []Event + +// String returns a string representation of the multiple messages event. +func (e MultiEvent) String() string { + var sb strings.Builder + for _, ev := range e { + sb.WriteString(fmt.Sprintf("%v\n", ev)) + } + return sb.String() +} + +// WindowSizeEvent is used to report the terminal size. Note that Windows does +// not have support for reporting resizes via SIGWINCH signals and relies on +// the Windows Console API to report window size changes. +type WindowSizeEvent struct { + Width int + Height int +} + +// WindowOpEvent is a window operation (XTWINOPS) report event. This is used to +// report various window operations such as reporting the window size or cell +// size. +type WindowOpEvent struct { + Op int + Args []int +} |
