Commit Graph

21 Commits

Author SHA1 Message Date
Preston Baxter 14c9ee8b4d adjust bubble tea mod 2024-02-10 22:25:40 -06: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
Ayman Bagabas a154847611
feat: extended Coordinates mouse reporting & additional buttons support (#594)
* feat(mouse): add extended mouse & shift key support

Support SGR(1006) mouse mode
Support parsing shift key press
Support additional mouse buttons
Report which button was released
Report button motion

* fix: key.go sgr len missing calculation (#841)

* chore(test): add sgr mouse msg detect test

---------

Co-authored-by: robinsamuel <96998379+robin-samuel@users.noreply.github.com>
2023-12-04 11:50:59 -05: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
naglis 91dd120073 docs: fix `WithFPS` godoc 2023-07-24 12:37:31 -04:00
tomfeigin f3e1b67605
(feat): Add option to set max FPS (#578)
* (feat): add option for setting FPS on renderer

Co-authored-by: Christian Rocha <christian@rocha.is>
2023-06-06 17:49:11 +02: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
Ayman Bagabas 29254a08f1
fix(output): reuse termenv output (#715)
If the passed io.Writer is a termenv.Output, use it instead of creating
a new termenv.Output.
2023-04-26 16:04:14 -04: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
Glenn Gonda 4880cf2a09 docs: fix typos and clean up comments 2023-02-19 08:45:22 -05:00
Christian Muehlhaeuser e15bcb7e0e feat: tea.WithContext ProgramOption to supply a context
WithContext lets you specify a context in which to run the Program.
This is useful if you want to cancel the execution from outside.
When a Program gets cancelled it will exit with an error
ErrProgramKilled.
2022-10-23 05:59:10 +02:00
Christian Muehlhaeuser 6b77c8fc10 chore: rename StartReturningModel to Run
Added aliases for the old functions, but deprecated them.
2022-10-08 01:34:17 +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 1e1b5f716d chore: gofmt sources 2022-08-15 12:25:55 +02:00
Christian Rocha 119144e78c ANSI compression is now opt-in via the WithANSICompressor program option 2021-10-30 13:04:27 -04:00
Christian Rocha 9f9b3aea96 Read input regardless of whether or not it's a TTY
This commit also contains some refactors:

* Refactor away inputStatus type
* Refactor away program.inputIsTTY member
* Simplify how we setup and restore input when it's a TTY
2021-08-02 10:50:04 -04:00
Christian Rocha 9826251f08 Add WithInputTTY ProgramOption 2021-08-02 10:50:04 -04:00
Christian Rocha e87344b791 Move ProgramOptions into a separate file 2021-08-02 10:50:04 -04:00