Commit graph

25 commits

Author SHA1 Message Date
Liam Stanley
c60f0c5304
fix: prevent data race with cursedRenderer.onMouse (#1691)
- closes #1690
- adds `-race`, `-count`, and `-cpu`
- make all viable tests parallel

Signed-off-by: Liam Stanley <liam@liam.sh>
2026-05-11 21:11:40 -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
688573d200
refactor: remove WithContext and pass context to Run 2025-10-01 13:50:32 -04:00
Ayman Bagabas
33dd5b01ba
refactor: rework tracing and use a standalone logger 2025-05-19 13:23:45 -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
8b7543cf35
fix: tests: remove without renderer option test 2025-02-13 12:15:56 -05:00
Ayman Bagabas
a7d49d01a4
chore: remove deprecated 2024-09-19 13:21:00 -04:00
Ayman Bagabas
9636413107 fix: use safeWriter to guard writing to output
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.
2024-09-12 13:22:33 -04:00
Ayman Bagabas
516b7cd4dc fix: renderer: nilRenderer doesn't need to be exported 2024-09-12 11:54:01 -04:00
Ayman Bagabas
0825f6113d
feat: export nil renderer 2024-08-20 12:18:23 -04:00
Ayman Bagabas
cb801d8f2c
refactor: use x/term and x/ansi for renderer sequences (#962)
* 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
2024-05-21 14:46:11 -04:00
Raphael 'kena' Poss
2b46020ca0
feat: bracketed paste (#397)
* feat: bracketed paste

This introduces support for input via bracketed paste, where escape
characters in the pasted input are not interpreted.

Pasted input are marked as a special field in the KeyMsg. This is
useful because pasted input may need sanitation in individual widgets.

* fix(key): support bracketed paste with short reads

Some terminal emulators feed the bracketed paste data in multiple
chunks, which may not be aligned on a 256 byte boundary. So it's
possible for `input.Read` to return less than 256 bytes read
but while there's still more data to be read to complete a bracketed
paste input.

---------

Co-authored-by: Christian Muehlhaeuser <muesli@gmail.com>
2024-02-05 14:49:09 +01:00
Carlos Alexandro Becker
5984e69f09
fix: race changing ignoreSignals (#791)
* fix: race changing ignoreSignals

* fix: atomic.Uint32
2023-11-07 13:49:00 -03:00
Christian Rocha
fcc805f3da chore: make input options mutually exclusive 2023-05-05 15:41:46 -04:00
Carlos Alexandro Becker
5326d76c40
feat: allow to disable signals (#721)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-05-04 16:33:25 -03:00
Christian Muehlhaeuser
c56884c0e2
feat: add generic event filter (#536)
`WithFilter` lets you supply an event filter that will be invoked
before Bubble Tea processes a `tea.Msg`. The event filter can return
any `tea.Msg` which will then get handled by Bubble Tea instead of
the original event. If the event filter returns nil, the event
will be ignored and Bubble Tea will not process it.

As an example, this could be used to prevent a program from
shutting down if there are unsaved changes.

Based on the fantastic work by @aschey and supersedes #521.

Resolves #472.
2023-04-17 22:02:55 +02:00
Christian Muehlhaeuser
76ce669474 chore: make CatchPanics an option flag 2022-10-07 22:33:06 +02:00
Christian Muehlhaeuser
0ac6702e11 feat: make signal handler optional
You can now initialize a tea app without a signal handler:

p := NewProgram(model, WithoutSignalHandler())
2022-10-07 21:46:06 +02:00
Christian Muehlhaeuser
6c449e55bf feat: use Termenv.Output to write to tty 2022-09-27 02:49:36 +02:00
Christian Muehlhaeuser
b237b7fbec test: fix error in custom input test 2022-06-04 15:21:08 +02:00
Carlos A Becker
cb0a72d682 test: nil renderer, options and screen 2021-11-15 10:28:46 -05:00