Commit Graph

806 Commits

Author SHA1 Message Date
Mark Marryatt 76c3c1a221 docs: fix portal broken markdown URL 2023-02-16 17:42:54 -05:00
Alexander Jung 331a63bdca fix: Check if program cancelReader is is nil before invoking
This commit fixes an issue where a user may provider a nil input via
`tea.WithInput(nil)`.  This option method does not check if the input
is nil and sets the `withCustomInput` attribute with a nil input.
This logic is sound since a Tea program may not necessarily want to
handle any inputs from users (such as those in non-TTY environments).

However, a nil pointer exception is thrown during `tea.Run` because a
`cancelReader` is always invoked after the main renderer.  However,
its instantiation is variable and dependent on whether an input is
provided. To mitigate against this, this commit checks if a
`cancelReader` is non-nil.

Signed-off-by: Alexander Jung <alex@nderjung.net>
2023-02-08 17:04:49 +01:00
Christian Rocha 1ad9f9c15c chore(deps): bump termenv and go-isatty
Also bump various deps in tutorials and examples
2023-02-08 10:04:56 -05:00
Christian Rocha cb23938f3f chore(docs): additional Bubble Tea in the wild cleanup 2023-02-08 09:53:02 -05:00
dependabot[bot] b30cca3906 chore(deps): bump github.com/muesli/termenv in /examples
Bumps [github.com/muesli/termenv](https://github.com/muesli/termenv) from 0.13.0 to 0.14.0.
- [Release notes](https://github.com/muesli/termenv/releases)
- [Commits](https://github.com/muesli/termenv/compare/v0.13.0...v0.14.0)

---
updated-dependencies:
- dependency-name: github.com/muesli/termenv
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-08 09:36:45 -05:00
Christian Rocha db1a095425 chore(docs): cleanup Bubble Tea in the Wild 2023-02-08 09:27:29 -05:00
Christoffer Åström e95e1a0db5 feat: `sequence` support `BatchMsg` 2023-02-07 10:06:46 -05:00
koki-develop a3dc561104 docs: add cLive to "Bubble Tea in the Wild" 2023-02-06 14:17:49 -05:00
BoilingSoup d7bc683260 fix typo 2023-02-06 10:24:24 -05:00
Pradeep Chhetri 45cded1ffc Add chtop to the list built with bubbletea
Signed-off-by: Pradeep Chhetri <pradeepchhetri4444@gmail.com>
2023-02-06 10:22:14 -05:00
Brian Strauch da44346bd3 Update README.md 2023-02-06 10:17:36 -05:00
Petar Jager d2a775ef2e docs: add SlurmCommander to in-the-wild section 2023-01-23 10:04:45 -05:00
Yahya SayadArbabi fbecc47be2 feat(README): add enola to "Bubble Tea in the Wild" list 2023-01-23 09:53:14 -05:00
マリウス 263444cdfb docs: add Neon Modem Overdrive to "in the wild" 2023-01-23 09:51:40 -05:00
Alexander Jung b217449c8e fix: Check msg cmd is not nil before invoking
GitHub-Fixes: #639
Signed-off-by: Alexander Jung <alex@nderjung.net>
2023-01-23 09:47:19 -05:00
dependabot[bot] ede4aec24e chore(deps): bump github.com/mattn/go-isatty in /examples
Bumps [github.com/mattn/go-isatty](https://github.com/mattn/go-isatty) from 0.0.16 to 0.0.17.
- [Release notes](https://github.com/mattn/go-isatty/releases)
- [Commits](https://github.com/mattn/go-isatty/compare/v0.0.16...v0.0.17)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-isatty
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-03 17:46:19 +01:00
Solomon White b63a0ae37f docs: add brows to "in the wild" app list 2022-12-16 12:36:53 -05:00
Christian Rocha 3765727e65
docs(examples): add cellbuffer + harmonica example (#409) 2022-12-12 09:52:00 -05:00
Christian Muehlhaeuser 79c76c680b chore: disable dependabot timer 2022-11-18 02:17:42 +01:00
Ayman Bagabas 94d6f5079e
docs: update readme 2022-11-14 13:31:59 -08:00
Christian Muehlhaeuser 9c20a804d7 fix: don't close stdin
This allows programs to re-use stdin after the tea.Program has
finished.

Fixes #595.
2022-11-13 23:55:44 +01:00
Austin Vazquez e079831c31 Remove references to io/ioutil package
Package io/ioutil has been marked deprecated starting in Go 1.16.

Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2022-11-10 13:51:29 +01:00
dependabot[bot] 7ba62d4987 chore(deps): bump github.com/charmbracelet/glamour in /examples
Bumps [github.com/charmbracelet/glamour](https://github.com/charmbracelet/glamour) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/charmbracelet/glamour/releases)
- [Commits](https://github.com/charmbracelet/glamour/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: github.com/charmbracelet/glamour
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-10 13:50:14 +01:00
Martin Dosch 2d10416631 [codespell]: Fix typos. 2022-11-03 12:55:31 -04:00
Christian Muehlhaeuser 741f2d37f0 fix: pass actual stdout's fd to command 2022-11-01 00:21:02 +01:00
Christian Muehlhaeuser 4f83c621fb chore: apply ProgramOptions before checking context
We don't need to set the background context if an outside context
was supplied.
2022-10-30 06:17:27 +01:00
Christian Muehlhaeuser 280bc6fc27 docs: clean up readme 2022-10-25 03:49:02 +02:00
Christian Muehlhaeuser bc2befecca docs: picture tag is causing display issues on Firefox 2022-10-25 03:22:49 +02:00
Christian Muehlhaeuser 39381647f1 docs: new readme footer 2022-10-24 10:13:38 +02: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 0f1ce7f2d9 fix: maintain cursor visibility across altscreen state switch
Based on #462 and #452 by @londek, but fixes maintaining the
current visibility state across altscreen state changes.

This makes the behavior consistent across terminals, some of which
keep separate state for altscreen and regular buffer.

Fixes #190.
2022-10-23 03:25:11 +02:00
treilik 918d35746b feat: export BatchMsg
There's no good reason to keep it private. Exporting it helps
testability, debugging, and allows for a few special model.Update
implementations.
2022-10-22 22:51:46 +02:00
Christian Muehlhaeuser 80f44c9384 fix: detect terminal size after exec
Based on @knz's work in #499, but slightly supersedes this change.

A little more coupling in the resize handling, but a lot less code
& logic repetition.

Co-authored-by: Raphael 'kena' Poss <knz@thaumogen.net>
2022-10-22 22:02:56 +02:00
Christian Muehlhaeuser 9bcfc026a2 fix: restore Windows console mode on shutdown
The deferred Close call on our input reader caused the console mode
to be reset twice, and the incorrect, inner mode was applied last.
2022-10-20 20:38:33 +02:00
Christian Muehlhaeuser a7067fbfa2 fix: prevent renderer from overflowing available height
Drops lines from the top when the render buffer is taller than the
available height.

Fixes #297.
2022-10-18 06:33:37 +02:00
Raphael 'kena' Poss cbe309d624 fix: don't delay messages behind a long command 2022-10-16 17:06:27 +02:00
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