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 364 commits into
base: main
Choose a base branch
from
Draft

(v2) Bubble Tea v2 #1118

wants to merge 364 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
This implements a wrapper around p.output that locks the output on every
write. We also need to redefine `channelHandlers` to be thread-safe
since `p.Kill()` can be called from a different thread while the program
is running.
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
* feat: combine keyboard enhancements into a nicer API

This change combines the keyboard enhancements into a nicer API. Kitty
keyboard protocol and XTerm modifyOtherKeys are now combined into a
single API. This makes it easier to enable keyboard enhancements.

Use `WithKeyboardEnhancements` to enable keyboard enhancements. This
function accepts a list of `KeyboardEnhancement` functions that can be
used to enable different keyboard features.

For now, we only support the `WithReleaseKeys` enhancement which enables
support for reporting release key events.

* Update options.go

Co-authored-by: Christian Rocha <[email protected]>

* chore: go mod tidy

* chore: gofumpt

* fix: simplify keyboard enhancements disambiguation

* feat: make KeyboardEnhancementsMsg helpers always return true on Windows

* fix: remove unused win32input mode

* refactor: rename KeyboardEnhancementsMsg methods

---------

Co-authored-by: Christian Rocha <[email protected]>
meowgorithm and others added 30 commits January 31, 2025 16:32
Fixes: 51536c0 (fix: renderer: make sure to move the cursor to the top left corner after clearing the screen)
This introduces a new `CursorModel` interface that can be implemented by
the main model to provide a cursor position and style. A nil cursor will
hide the cursor. Otherwise, the cursor will be shown at the position and
with the style specified. Use `NewCursor` to quickly create a cursor for
a given position with default styles. This method is called in-sync with
the `Model.View` method.

It also removes the previously introduced `Frame` type and `NewFrame`
function. The main model can now return a `string` to render the program's
UI. The main model can return a `Cursor` to set the cursor position and
style.

The old `Init` method is now back and it returns a `Cmd` instead of a
both a `Model` and a `Cmd`. This is to make the mental model more straight
forward, and to keep things backwards compatible.
* feat: renderer: readd standard renderer

* Update tea.go

Co-authored-by: Christian Rocha <[email protected]>

---------

Co-authored-by: Christian Rocha <[email protected]>
This updates the renderer to use backspace to optimize cursor movements
when the terminal supports it. This is similar to the hard tabs
optimization, but for backspace to move the cursor left.
This adds a new option to set the initial window size of the terminal
window. This is useful in testing and required for teatest/v2 after the
changes in the renderer. The cell-based cursed renderer heavily relies
on the terminal size, and it's important to have a way to set the size
manually for tests to run in a non-interactive environment.
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.

4 participants