-
Notifications
You must be signed in to change notification settings - Fork 794
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
164
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
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 <[email protected]>
This replaces enable/disable directives with exception to alt-screen and cursor visibility since those affect the renderer.
Signed-off-by: Carlos Alexandro Becker <[email protected]>
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 <[email protected]>
Signed-off-by: Carlos Alexandro Becker <[email protected]>
This adds the ability to read and set terminal background, foreground, and cursor color.
aymanbagabas
force-pushed
the
v2-exp
branch
2 times, most recently
from
September 20, 2024 20:00
dd32151
to
6073691
Compare
This uses kitty keyboard protocol "Report alternate keys" and "Report all keys as escape codes" to report key events as though they were on a PC-101 layout. This is useful for uniform key event reporting across different keyboard layouts.
aymanbagabas
force-pushed
the
v2-exp
branch
from
September 20, 2024 20:05
6073691
to
d2bffc5
Compare
aymanbagabas
force-pushed
the
v2-exp
branch
from
September 20, 2024 20:09
d2bffc5
to
84b68c5
Compare
Some terminals such as WezTerm report incorrect press and release sequences when "report event types" enhancement is enabled. This patch adds support for these faulty mappings. Related: wez/wezterm#6160
This should fix the textinputs example, as the code is using KeyMsg. KeyMsg seems to have an issue with the v2 alpha where it appears that both KeyPressMsg and KeyReleaseMsg may be unintentionally being called sequentionally. Just using one or the other should solve the issue for this. This issue also likely exists within other examples and may Need to be looked at separately. No PR/Issue Tag atm
When a printable character is pressed with no modifiers, the `key.Mod` field is set to 0. In this case, the `key.Code` field should be used to determine the text to send to the program. Fixes: c53a7c9 (fix: kitty: use the correct case for key text)
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`
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