-
Notifications
You must be signed in to change notification settings - Fork 799
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
185
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
+7,088
−4,134
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
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. Supersedes: #1079 Supersedes: #1014 Related: #869 Related: #163 Related: #918 Related: #850 Related: #207
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This replaces enable/disable directives with exception to alt-screen and cursor visibility since those affect the renderer.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
We need to initialize the tty and the input handler before writing to it.
A modified F3 key press has the same sequence as cursor position report. We need to handle that by reporting both messages and letting the program determine which one to listen for. On most cases, programs don't care about modified F3 key press since terminals tend to have different sequences for it.
Move tracking bp to the program instead of the renderer. The renderer doesn't need to know about the state of bp and gains nothing from that information.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This adds the ability to read and set terminal background, foreground, and cursor color.
This fixes a bunch of issues on Windows bringing improvements and reliability to the implementation. It replacing the existing key events hack with a key state that keeps track of previous key events to parse the incoming ANSI escape sequences. It also decodes unicode utf16 pairs at the parser level instead of the driver level. Related: #1126
…1163) This fixes a bunch of issues on Windows bringing improvements and reliability to the implementation. It replaces the existing key events hack with a key state that keeps track of previous key events to parse the incoming ANSI escape sequences. It also decodes unicode utf16 pairs at the parser level instead of the driver level. Related: #1126 TODO: - [x] Windows API tests - [x] Key events - [x] Mouse events - [x] Resize events - [x] Focus events
This commit adds support for changing the cursor style. The new `SetCursorStyle` command can be used to change the cursor style to one of the following: - `CursorBlock` - `CursorUnderline` - `CursorBar`
This commit changes the behavior of grapheme clustering to be opt-in instead of opt-out. This is because some terminals like Apple Terminal don't support DECRQM and DECRPM, which are required for querying and setting the grapheme clustering state. Apple Terminal, instead, replies with a `p` character when querying the grapheme clustering state, which is not a valid response and breaks the program output.
Before initializing the input reader, we need to ensure that the console input buffer is empty, otherwise, we can get dangling events from previous sessions.
…mes (#1205) * chore: use verbs in background, foreground, and window request cmd names This renames a few existing commands to make it clearer that the user is firing off a task. * WindowSize -> RequestWindowSize * ForegroundColor -> RequestForegroundColor * BackgroundColor -> RequestBackgroundColor It also expands on a few comments, and provides examples. * fix: screen tests * fix(examples): use RequestWindowSize instead of WindowSize --------- Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>
This change updates the standard renderer to use the colorprofile.Writer to downsample colors when writing to the terminal.
This adds support for detecting the terminal's color profile. It adds a new `ColorProfileMsg` message that get sent when the program starts. You can force a specific color profile using the `WithColorProfile` option. When a program requests the `RGB` or `Tc` terminfo capabilities, Bubble Tea will read the response, if there is one, and upgrade the cached color profile and send the new profile to the program again. Supersedes: #1142 Supersedes: #1143
This commit wraps the input parser in a struct and moves the tracing logic to the program and its writer and input driver. It also changes the behavior of the tracer to only enable tracing for local environment variables i.e. from `os.Getenv` and not from the program's environment. In other words, it will ignore the program's environment variables when it comes to tracing.
Fixes: 83a84e4 (refactor: move input tracing to input parser and simplify tracing)
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