-
Notifications
You must be signed in to change notification settings - Fork 819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(v2) Bubble Tea API #1118
Draft
aymanbagabas
wants to merge
267
commits into
main
Choose a base branch
from
v2-exp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
(v2) Bubble Tea API #1118
+8,214
−4,262
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Carlos Alexandro Becker <[email protected]>
This adds the ability to read and set terminal background, foreground, and cursor color.
This adds support to setting the system and primary (X11 & Wayland) clipboards using OSC52. This makes the clipboard commands work even on remote session such as SSH. While this doesn't work on all terminals, most modern terminals support OSC52 including Alacritty, Kitty, Xterm.JS, etc. For terminals, that don't support OSC52, application developers should consider using a Golang clipboard library like https://github.com/atotto/clipboard. OSC52 support can be detected if the terminal responds to a `ReadClipboard` command. Fixes: #982
This adds support for XTVERSION and DA1 querying. XTVERSION responds with the version of the terminal (not supported by all terminals) DA1 responds with some of the terminal capabilities
Use bitmap matching to check if a modifier contains another
Currently, Bubble Tea uses a simple lookup table to detect input events. Here, we're introducing an actual input sequence parser instead of simply using a lookup table. This will allow Bubble Tea programs to read all sorts of input events such Kitty keyboard, background color, mode report, and all sorts of ANSI sequence input events. This PR includes the following changes: - Support clipboard OSC52 read messages (`OSC 52 ?`) - Support terminal foreground/background/cursor color report messages (OSC10, OSC11, OSC12) - Support terminal focus events (mode 1004) - Deprecate the old `KeyMsg` API in favor of `KeyPressMsg` and `KeyReleaseMsg` - `KeyType` const values are different now. Programs that use int value comparison **will** break. E.g. `key.Type == 13` where `13` is the control code for `CR` that corresponds to the <kbd>enter</kbd> key. (BREAKING CHANGE!) - Bubble Tea will send two messages for key presses, the first of type `KeyMsg` and the second of type `KeyPressMsg`. This is to keep backwards compatibility and _not_ break the API - `tea.Key` contains breaking changes (BREAKING CHANGE!) - Deprecate `MouseMsg` in favor of `MouseClickMsg`, `MouseReleaseMsg`, `MouseWheelMsg`, and `MouseMotionMsg` - Bubble Tea will send two messages for mouse clicks, releases, wheel, and motion. The first message will be a `MouseMsg` type. And the second will have the new corresponding type. This is to keep backwards compatibility and _not_ break the API - `tea.Mouse` contains breaking changes (BREAKING CHANGE!) - Support reading Kitty keyboard reports (reading the results of sending `CSI ? u` to the terminal) - Support reading Kitty keyboard and fixterms keys `CSI u` - Support reading terminal mode reports (DECRPM) - Bracketed-paste messages now have their own message type `PasteMsg`. Use `PasteStartMsg` and `PasteEndMsg` to listen to the start/end of the paste message. - Bubble Tea will send two messages for bracketed-paste, the first is of type `KeyMsg` and the second is of type `PasteMsg`. This is to keep backwards compatibility and _not_ break the API - Support more obscure key input sequences found in URxvt and others - Support reading termcap/terminfo capabilities through `XTGETTCAP`. These capabilities will get reported as `TermcapMsg` - Support reading terminfo databases for key input sequences (disabled for now) - Support reading [Win32 Input Mode keys](https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md#win32-input-mode-sequences) - Support reading Xterm `modifyOtherKeys` keys TODO: - [x] Parse multi-rune graphemes as one `KeyPressMsg` storing it in `key.Runes` - [x] Kitty keyboard startup settings and options #1083 - [x] Xterm modify other keys startup settings and options #1084 - [x] Focus events startup settings and options #1081 - [x] Fg/bg/cursor terminal color startup settings and options #1085 Supersedes: #1079 Supersedes: #1014 Related: #869 Related: #163 Related: #918 Related: #850 Related: #207
This is an alternative protocol to Kitty. They can go hand-in-hand and it's up to the terminal to report the encoded sequence.
This adds support for XTVERSION and DA1 querying. XTVERSION responds with the version of the terminal (not supported by all terminals) DA1 responds with some of the terminal capabilities
…#1086) This adds support to setting the system and primary (X11 & Wayland) clipboards using OSC52. This makes the clipboard commands work even on remote session such as SSH. While this doesn't work on all terminals, most modern terminals support OSC52 including Alacritty, Kitty, Xterm.JS, etc. For terminals, that don't support OSC52, application developers should consider using a Golang clipboard library like https://github.com/atotto/clipboard. OSC52 support can be detected if the terminal responds to a `ReadClipboard` command. Fixes: #982
~This implements a cell-based renderer instead of the existing line-based one. The cell-based renderer will be used when `TEA_EXPERIMENTAL=cellbuf` is exported.~ The cell-based renderer, now called The Ferocious Renderer, is enabled by default. To disable it set `TEA_EXPERIMENTAL=unferocious`. To _trace_ the output of the program, you can export `TEA_TRACE=<filename>` and `TEA_TRACE_OUTPUT=1` and/or `TEA_TRACE_INPUT=1` to see the I/O of the program. Supersedes: #1132
The ferocious renderer is now opt-in. This commit adds a new option `WithFerociousRenderer` that enables the ferocious renderer.
Fixes: 29a3c0d (chore: merge branch 'main' into v2-exp)
* feat: updating x/ansi Signed-off-by: Carlos Alexandro Becker <[email protected]> * fix: enable/disable mode * fix: execute in private mode, fix tests Signed-off-by: Carlos Alexandro Becker <[email protected]> * fix: update deps Signed-off-by: Carlos Alexandro Becker <[email protected]> * fix: test Signed-off-by: Carlos Alexandro Becker <[email protected]> * feat: update cellbuf Signed-off-by: Carlos Alexandro Becker <[email protected]> * all the updates Signed-off-by: Carlos Alexandro Becker <[email protected]> --------- Signed-off-by: Carlos Alexandro Becker <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will keep track of the changes upcoming in Bubble Tea v2
Init()
return the model