Skip to content
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 v2 #1118

Draft
wants to merge 401 commits into
base: main
Choose a base branch
from
Draft

(v2) Bubble Tea v2 #1118

wants to merge 401 commits into from

Conversation

aymanbagabas
Copy link
Member

@aymanbagabas aymanbagabas commented Aug 28, 2024

This PR will keep track of the changes upcoming in Bubble Tea v2

  • Input sequence parser
  • Kitty keyboard
  • Xterm modifyOtherKeys
  • Mode 2027 (grapheme clustering)
  • Setting/getting terminal background/foreground/cursor colors
  • Setting/getting the clipboard using OSC52
  • Make Init() return the model
  • New Key/Mouse API (v2) Use KeyMsg/MouseMsg interfaces #1111

@aymanbagabas aymanbagabas changed the title V2 exp (v2) Bubble Tea API Aug 28, 2024
@aymanbagabas aymanbagabas added this to the v2.0.0 milestone Aug 29, 2024
@aymanbagabas aymanbagabas force-pushed the v2-exp branch 7 times, most recently from d2bffc5 to 84b68c5 Compare September 20, 2024 20:09
aymanbagabas and others added 19 commits October 15, 2024 11:31
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: wezterm/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`
caarlos0 and others added 5 commits February 11, 2025 13:42
The cursed renderer moves the cursor between renders, which can cause
issues when the terminal is released and restored. For instance, when
we exec a command using tea.Exec, we want the cursor position to remain
the same after the command finishes and goes back to the same position
as before the command was executed.

With tea.Suspend on the other hand, we want to make sure we reset the
cursor position because the program stops executing and is put to
suspend. Resuming the program again initializes the renderer and its
cursor position again from scratch as if it was a new program.

This wasn't an issue for the standard renderer because we always put the
cursor at the lower left corner of the screen. Releasing and restoring
the program wasn't an issue because the cursor was always at the same
position.
aymanbagabas and others added 24 commits February 12, 2025 12:32
This change separates the viw from the main model by introducing new
interfaces `ViewModel` and `CursorModel`. The `ViewModel` interface
provides a view method that returns the string to render, while the
`CursorModel` interface provides a view method that returns the string
to render and the cursor position.

If a program does not implement a view interface, the program won't
render anything. This removes the need for the `WithoutRenderer` option.
This change separates the viw from the main model by introducing new
interfaces `ViewModel` and `CursorModel`. The `ViewModel` interface
provides a view method that returns the string to render, while the
`CursorModel` interface provides a view method that returns the string
to render and the cursor position.

If a program does not implement a view interface, the program won't
render anything. This removes the need for the `WithoutRenderer` option.
* fix: windows: enable mouse mode on demand

This fixes an issue where mouse mode is always enabled on Windows. With
this patch, we enable mouse events only it is requested.

Needs: charmbracelet/x#386
Related: #1313

* refactor: mouse: properly handle mouse mode

Since mouse mode has a special case on Windows, we now have
separate msg types for mouse events.

* chore: go mod tidy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants