Commit Graph

720 Commits

Author SHA1 Message Date
Christian Muehlhaeuser 3609d87e70 fix: don't block in Send after shutdown
Send should block before a tea.Program has been started, but result
in a no-op when it has already been terminated.

Fixed godocs.
2022-10-15 04:21:44 +02:00
Christian Muehlhaeuser a520b7f4e1 fix: ensure a final render before a clean shutdown
Fixes #274.
2022-10-13 07:55:48 +02:00
Christian Muehlhaeuser 99ad2eda0d fix: also lock mutex when accessing state read-only 2022-10-13 06:56:45 +02:00
Christian Muehlhaeuser db664820d4 fix: lock mutex before checking altscreen state
This prevents the odd race condition where Enter- & ExitAltScreen
are called concurrently.
2022-10-13 04:50:50 +02:00
Christian Muehlhaeuser b8ef6f85ea feat: support ctrl+page up/down keys
Adds support for ctrl+(alt)+page up/down key events.

Tested in konsole, alacritty, foot, urxvt, and a few other
terminals.

Fixes #369.
2022-10-12 07:11:20 +02:00
Benjamin DeCoste aba3cec050
docs: fix code in commands tutorial (#501) 2022-10-12 05:45:51 +02:00
Christian Muehlhaeuser 1ed623fdc0 fix: kill should result in Start returning an error
This fixes Kill resulting in a final nil model being returned.

We can also drop the kill channel and rely on our existing context
channel.
2022-10-12 05:26:39 +02:00
Christian Muehlhaeuser fd18c149df fix: restoreTerminalState resets mouse handling state
- fixes mouse handling being enabled during sub commands
- fixes shutdown order: restore mouse state before alt screen
2022-10-12 00:36:09 +02:00
Josh Soref 4aa9ce489b
docs: fix spelling / various typos (#526) 2022-10-11 14:40:01 +02:00
Christian Muehlhaeuser 8703897aad fix: timeout when waiting for CancelReader
Fixes #524.
2022-10-11 12:42:40 +02:00
Christian Muehlhaeuser b9bd01b79a fix: lock renderer during stop/kill 2022-10-09 05:57:44 +02:00
Christian Muehlhaeuser e119cd88b2 fix: prevent double repaint when restoring terminal 2022-10-09 05:57:23 +02:00
Christian Muehlhaeuser 1c3b792596 chore: don't use deprecated methods internally 2022-10-09 05:33:32 +02:00
Christian Muehlhaeuser a11ff932fa test: complete nil renderer test 2022-10-09 04:23:14 +02:00
Christian Muehlhaeuser 8e79fdd50b test: add screen manipulation tests 2022-10-09 04:14:09 +02:00
Christian Muehlhaeuser 13cdfd2719 test: exec returning an error for invalid and failing commands 2022-10-09 03:46:59 +02:00
Christian Muehlhaeuser 77619d21f5 test: add sequenceMsg test 2022-10-08 19:02:54 +02:00
Christian Muehlhaeuser 9117bbc137 test: add batchMsg test 2022-10-08 18:52:09 +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 22d15efad7 chore: clean up linter errors in examples 2022-10-08 00:56:56 +02:00
Leandro López (inkel) 8b8fd12201 Update Program.Start docs to indicate it's a blocking operation
This addresses one of the concerns in #299.
2022-10-08 00:51:36 +02:00
Christian Muehlhaeuser 9bde73bd4e chore: reorganize Program struct 2022-10-07 23:39:36 +02:00
Christian Muehlhaeuser fbb00cc71e fix: close input on shutdown whenever possible 2022-10-07 23:38:27 +02:00
Christian Muehlhaeuser 6477a53545 chore: store handlers and simplify teardown 2022-10-07 23:18:35 +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 2696b2f339 chore: break up Start into several, more maintainable methods 2022-10-07 20:13:57 +02:00
Raphael 'kena' Poss 0e76ba142a fix(key): recover the insert key
We started supporting insert in #418, but then accidentally
removed it during a rebase in #396. Oops.
2022-10-07 14:54:27 +02:00
Christian Muehlhaeuser f406999cba fix: don't try to set alt screen when already in desired mode 2022-10-06 12:50:51 +02:00
Christian Muehlhaeuser ca8b21a3e2 fix: force repaint after clearing the screen 2022-10-04 17:34:09 +02:00
Christian Muehlhaeuser 6b6bf6ab6d fix: don't access output from outside renderer 2022-10-04 06:12:17 +02:00
Raphael 'kena' Poss 5d1a7264c5 fix: ensure alt screen switch always clears terminal 2022-10-04 06:01:52 +02:00
Raphael 'kena' Poss 6e1065830a feat: support a Clear command 2022-10-04 06:01:52 +02:00
Christian Muehlhaeuser 37b79f55f1 feat: add tea.ShowCursor, complementing tea.HideCursor 2022-10-04 05:39:38 +02:00
Christian Muehlhaeuser 8d6bdcf2fd chore: reorganize command helpers 2022-10-04 05:29:41 +02:00
Christian Muehlhaeuser e4ca150210 chore: reorganize screen commands & messages 2022-10-04 05:20:07 +02:00
Christian Muehlhaeuser ea36e19bee fix: move output handling to renderer 2022-10-04 05:06:42 +02:00
Leandro López 7cf0d54bd4
docs: fix typo in Tick godoc (#477) 2022-10-04 04:14:42 +02:00
Raphael 'kena' Poss 7e7a729b31 fix: remove the now-unused hexes key mapping
This became unnecessary when we fixed the support for the Alt modifier
on control characters.
2022-10-03 22:43:17 +02:00
Raphael 'kena' Poss b074f6f5a4 fix: properly skip over unrecognized CSI sequences. 2022-10-03 22:43:17 +02:00
Maas Lalani d20732aaea docs: add examples/gifs locally to repository 2022-10-03 15:07:28 -04:00
Raphael 'kena' Poss 08518987f5 Reorder the function keys in key.go for better troubleshootability
Here the list of keys did not change, I simply re-ordered the lines
in the file.
2022-10-03 19:56:10 +02:00
Raphael 'kena' Poss ce923aabbf Add missing alt+ variant for F13-F16 2022-10-03 19:56:10 +02:00
Raphael 'kena' Poss 290ef8dce5 Add missing alt+ variant for F5-F12 on urxvt 2022-10-03 19:56:10 +02:00
Raphael 'kena' Poss d9b2889cf4 Add support for ctrl+, ctrl+shift+ for home/end keys 2022-10-03 19:56:10 +02:00
Raphael 'kena' Poss 5f76c2036d Reorganize key.go for clarity 2022-10-03 19:56:10 +02:00
Raphael 'kena' Poss 2fe4aad5e6 Fix home/end on vt100 2022-10-03 19:56:10 +02:00
Maas Lalani 70576bc9e0
examples/README.md GIFs (#470)
* docs(examples): Add `examples/README.md`

Adds `examples/README.md` with GIFs of examples

* docs(examples): Individual READMEs

* docs(examples): add short description to each example
2022-10-03 12:06:18 -04:00
Leo Robinovitch cd3f486ab5 Add wander to Bubble Tea in the Wild 2022-09-29 19:06:25 +02:00
Christian Muehlhaeuser b404baff60 chore: remove incorrect space before nolint directives 2022-09-27 10:02:34 +02:00