Commit graph

96 commits

Author SHA1 Message Date
Hsn
33f6a40ec0
docs: fix command and environment godoc examples (#1833) 2026-10-02 13:30:47 +04:00
draw me an elephant
8b10e22689
fix: skip capability queries when input is disabled (#1801)
Co-authored-by: drew <me@andrinoff.com>
Signed-off-by: drew <me@andrinoff.com>
2026-09-24 12:05:48 +04:00
Ayman Bagabas
718c8e750a
feat: restore WithoutRenderer option 2025-10-14 17:35:41 -04:00
Ayman Bagabas
87f9a5916b
fix: remove deprecated WithInputTTY option 2025-10-14 12:51:45 -04:00
Ayman Bagabas
be3c7e5427
refactor: restore options 2025-10-14 11:49:17 -04:00
Ayman Bagabas
0ee1cf13c9
refactor: move key enhancement logic and options to View struct 2025-10-01 13:50:38 -04:00
Ayman Bagabas
53884ef486
refactor: move term modes into View struct and renderer logic 2025-10-01 13:50:37 -04:00
Ayman Bagabas
fb3e0a4a3e
refactor: lean more into the View struct to manage terminal state 2025-10-01 13:50:37 -04:00
Ayman Bagabas
d1128242cd
refactor: remove WithWindowSize option in favor of InitialWidth and InitialHeight fields 2025-10-01 13:50:37 -04:00
Ayman Bagabas
fd39cfc36a
refactor: remove WithColorProfile option in favor of Program.ColorProfile field 2025-10-01 13:50:36 -04:00
Ayman Bagabas
6bc94a9be0
refactor: remove WithFPS option in favor of Program.FPS field 2025-10-01 13:50:36 -04:00
Ayman Bagabas
b4236df2e3
refactor: move WithFilter to Program.Filter 2025-10-01 13:50:35 -04:00
Ayman Bagabas
657e54ee0d
refactor: remove WithoutSignals option in favor of IgnoreSignals field 2025-10-01 13:50:35 -04:00
Ayman Bagabas
8b68181346
refactor: remove WithoutCatchPanics option in favor of a boolean field 2025-10-01 13:50:34 -04:00
Ayman Bagabas
cf7bb13866
refactor: remove WithoutSignalHandler option in favor of a field in Program struct 2025-10-01 13:50:34 -04:00
Ayman Bagabas
7b13c33c4f
refactor: remove WithEnvironment option in favor of Env field on Program 2025-10-01 13:50:34 -04:00
Ayman Bagabas
608155cf09
refactor: remove WithInputTTY option and related code 2025-10-01 13:50:33 -04:00
Ayman Bagabas
6b6414508e
refactor: replace WithInput and WithOutput options with Input and Output fields on Program struct 2025-10-01 13:50:33 -04:00
Ayman Bagabas
688573d200
refactor: remove WithContext and pass context to Run 2025-10-01 13:50:32 -04:00
Ayman Bagabas
9b921df874
feat: add option to disable key enhancements 2025-06-26 16:43:45 -04:00
Ayman Bagabas
a2fcb4d642
Merge branch 'v2-exp' into v2-exp-tv-io-viewable 2025-06-23 10:48:49 -04:00
Ayman Bagabas
99a80e67ee
feat: keyboard: split keyboard enhancements into separate functions
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.
2025-06-02 14:09:47 -04:00
Ayman Bagabas
33dd5b01ba
refactor: rework tracing and use a standalone logger 2025-05-19 13:23:45 -04:00
Ayman Bagabas
825e109a2a
fix: always enable basic keyboard enhancements to disambiguate keys
Right now, there is inconsistencies between Windows and other
*nix platforms when it comes to keyboard enhancement handling.
Since we use the Windows Console API on Windows, we always get
disambiguated keys and release events.

To make the experience consistent across platforms, we always enable
disambiguated keys for *nix platforms, and we ignore release events on
Windows unless they are explicitly requested, the same way we do for
*nix platforms.
2025-05-01 11:53:09 -04:00
desertwitch
9404e068c2
chore: merge branch 'stacked-patches' into v2-exp 2025-04-13 13:24:02 +02:00
desertwitch
1923181af6
fix: report only external ctx cancel as ctx error 2025-03-28 12:17:51 +01:00
Ayman Bagabas
1805861a99
feat: separate view in its own interface
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.
2025-02-13 12:15:56 -05:00
Ayman Bagabas
3fc1c224d4
chore: merge branch 'main' into v2-exp 2025-02-12 17:03:48 -05:00
Ayman Bagabas
cb6f8402f6
chore: revert "chore: deprecate some StartupOptions in favor of Cmds (#1307)"
This reverts commit 75d1b4b8cf.
2025-02-11 10:29:26 -05:00
Ayman Bagabas
f0d18bbad3
feat: add WithWindowSize option to set the initial window size (#1314)
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.
2025-02-07 17:42:18 -05:00
Ayman Bagabas
35ecfdd67f
chore: merge branch 'main' into v2-exp 2025-02-04 16:48:43 -05:00
Christian Rocha
75d1b4b8cf
chore: deprecate some StartupOptions in favor of Cmds (#1307) 2025-02-04 15:46:31 -05:00
Ayman Bagabas
4ed9c0a1ec
chore: merge: keyboard enhancements msg, expose types and track requested and active enhancements (#1286)
refactor: keyboard: expose type and track requested and active
enhancements

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`
as well as`EnableKeyboardEnhancements` to `RequestKeyboardEnhancements`.



Fixes: https://github.com/charmbracelet/bubbletea/issues/1283
2025-01-16 07:46:48 -05:00
Carlos Alexandro Becker
bfdb8c7fbc
fix: withFerociousRenderer is not used anymore 2025-01-15 13:04:52 -03:00
Ayman Bagabas
6f40250d70
chore: merge branch 'v2-exp' into v2-enh-keeb 2025-01-15 15:35:14 +03:00
Ayman Bagabas
65874a6122
refactor: keyboard: expose type and track requested and active enhancements
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`.
2025-01-13 08:23:28 +03:00
Ayman Bagabas
04c0b438d1
refactor: use the cursed renderer for rendering and remove the standard renderer
This also removes the experimental flags and changes the renderer
interface to be more explicit about the methods that are available.
2025-01-13 08:19:40 +03:00
Carlos Alexandro Becker
cb93959823
feat(SIGINT): better handle interrupts (#1255)
* feat(SIGINT): better handle interrupts

This PR introduces `Interrupt()`, `InterruptMsg{}`, and
`ErrInterrupted`.

Users can still handle "ctrl+c" as before, but instead of return
`tea.Quit`, they can return `tea.Interrupt`.

Later on, they can `errors.If(err, tea.ErrInterrupted)` and
`os.Exit(130)` if they want to.

* chore: fix unrelated typo

it was bothering me
2024-12-02 09:14:20 -03:00
Ayman Bagabas
b7a3c35132 feat: make the ferocious renderer opt-in
The ferocious renderer is now opt-in. This commit adds a new option
`WithFerociousRenderer` that enables the ferocious renderer.
2024-11-12 16:42:38 -05:00
Christian Rocha
c66c815d71
chore: add internal option for using the standard renderer 2024-11-06 13:30:10 -05:00
Christian Rocha
8bf66b02dd
feat: enable cell based renderer by default 2024-11-06 12:59:09 -05:00
Ayman Bagabas
250def3880
chore: merge branch 'v2-exp' into v2-renderer 2024-10-29 14:55:42 -04:00
Ayman Bagabas
64986246a7
chore: merge branch 'v2-exp' into v2-colorprofile 2024-10-28 15:30:59 -04:00
Ayman Bagabas
5a027d5fbe
chore: merge branch 'v2-exp' into v2-renderer 2024-10-23 16:37:42 -04:00
Ayman Bagabas
43b11c30b3 fix: make grapheme clustering opt-in
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.
2024-10-22 21:55:07 -04:00
Ayman Bagabas
dbd7ea6037
feat: add experimental features (#1183)
Right now, we only have one experimental feature to use the new cell buffer as a default renderer.
Use `TEA_EXPERIMENTAL=cellbuf` environment variable to enable the use of the cell buffer as the default renderer.
2024-10-16 16:53:00 -04:00
Ayman Bagabas
a7d49d01a4
chore: remove deprecated 2024-09-19 13:21:00 -04:00
Ayman Bagabas
7cb34becaf
(v2) feat: combine keyboard enhancements into a nicer API (#1152)
* 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>
2024-09-18 14:23:47 -04:00
Ayman Bagabas
8b51296eba
feat: support terminal color profiles
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: https://github.com/charmbracelet/bubbletea/pull/1142
Supersedes: https://github.com/charmbracelet/bubbletea/pull/1143
2024-09-16 17:35:30 -04:00
Ayman Bagabas
62e46fe66f
fix: unexport kitty, modifyOtherKeys, and windowsInputMode options 2024-09-16 14:40:23 -04:00