This commit refactors the keyboard enhancements functionality by
splitting the `WithKeyboardEnhancements` function into three separate
functions:
- `WithKeyReleases`: Enables support for reporting key release events.
- `WithUniformKeyLayout`: Enables support for reporting key events in a
uniform layout format.
- `RequestKeyDisambiguation`: Enables support for disambiguated key events.
This change improves clarity and usability by allowing users to enable
specific keyboard enhancements individually, rather than requiring them
to use a single function with multiple options.
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.
This change exposes the `KeyboardEnhancements` type and tracks requested
and active enhancements in the `Program` struct. This change also
renames the `KeyboardEnhancement` type to `KeyboardEnhancementOption`
and `keyboardEnhancements` to `KeyboardEnhancements` as well as
`EnableKeyboardEnhancements` to `RequestKeyboardEnhancements`.
* feat: updating x/ansi
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: enable/disable mode
* fix: execute in private mode, fix tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: update deps
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* fix: test
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* feat: update cellbuf
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* all the updates
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
* 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 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.
* 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 <christian@rocha.is>
* 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 <christian@rocha.is>
* feat: add mode 2027 grapheme clustering stubs
This adds the necessary stubs to make mode 2027 (grapheme clustering)
work on Bubble Tea with renderers that support it.
* fix: screen grapheme clustering tests
Use Mode/SetMode instead of EnableAltScreenBuffer/DisableAltScreenBuffer
etc. This uses less code and makes it more usable in the future to
accommodate for more terminal capabilities and modes.
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: https://github.com/charmbracelet/bubbletea/issues/982
* refactor: use x/exp/term for renderer sequences
This replaces termenv.Output with raw sequences and a bytes.Buffer to
handle vt screen and cursor events.
* chore: update dependencies
* refactor: use x/term