Commit Graph

653 Commits

Author SHA1 Message Date
Georgi Dimitrov 958dc20024 fix: race condition on repaint with alt screen
I didn't realise at the time, but the tea.Program and the renderer share
the mutex. This make the code difficult to reason about - it turns out
the program sometimes acquires the lock and then calls the
`setAltScreen` method of the renderer which in turns calls `repaint`.
That causes a deadlock as `repaint` is trying to acquire the lock too.
2022-06-07 06:47:46 +02:00
Georgi Dimitrov 50a8461fbf fix: race condition on repaint 2022-06-04 15:35:59 +02:00
Christian Muehlhaeuser b237b7fbec test: fix error in custom input test 2022-06-04 15:21:08 +02:00
Christian Muehlhaeuser 4c9117df96 ci: run tests on all platforms 2022-06-04 15:20:28 +02:00
Carlos Alexandro Becker b566614c16
docs: default to vim if no EDITOR on exec example (#325)
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-06-02 15:12:31 -03:00
Christian Rocha 04d68b8e3e chore(examples): bump bubbles dependency 2022-06-01 18:47:09 -07:00
Christian Rocha 775dbfbeff
chore(exec): small API edits (#323)
* feat: add OSExec helper function for running exec.Cmds

* chore: for now, un-expose WrapExecCommand

* chore: move exec struff into its own file

* chore(exec): better name for Exec func that wraps exec.Cmd (thanks, @toby)
2022-06-01 17:12:21 -07:00
Carlos Alexandro Becker 97050569c9
docs: improve godoc on tick and every (#320)
* docs: improve godoc on tick and every

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* docs: small improvements

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* docs: add loop examples for Tick/Every in GoDocs

* docs: small wording adjustments

* docs: small copy edits

Co-authored-by: Christian Rocha <christian@rocha.is>
2022-05-29 21:40:57 -03:00
Carlos A Becker a5f28a3a04 docs: fixed mentions to exec.Command
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-05-16 16:46:27 +00:00
Christian Rocha d301ee0405
change(keys): spacebar sends a `KeySpace` (#315)
* Revert "fix: update tests for space input"

This reverts commit bfb166822e.

* Revert "feat: obliterate type KeySpace"

This reverts commit d3fb1b707a.
2022-05-13 13:24:16 -04:00
Christian Rocha bfb166822e fix: update tests for space input 2022-05-10 16:56:37 -04:00
Christian Rocha d3fb1b707a feat: obliterate type KeySpace
Treating a space differently from other runes was proving to cause more
confusion that clarity.
2022-05-10 16:56:37 -04:00
Christian Rocha 48cdc1e6c3
feat(keys): add support for shift/ctrl + arrow keys (#292)
* feat(keys): add support for shift/ctrl+arrow keys

* chore(keys): use sequences for shift/ctrl arrow keys

* feat(keys): support ctrl+shift+arrow keys

* chore(keys): use sequences for alt+arrows

* feat(keys): add support for arrow key combinations with alt modifiers

* fix(keys): remove an extreaneous check

* feat(keys): add support for urxvt arrow keys with modfiers

* feat(keys): add support for arrow keys in DECCKM mode

* docs(keys): expand on comment about ctrl+backtick

* chore(keys): migrate various bindings to sequences

* Minor comment improvements to the input parser

Co-authored-by: Bwahharharrr <yitang@tutanota.com>
2022-05-10 16:16:33 -04:00
bashbunni 14e58aa1f9
fix(keys): spacebar now sends a `KeySpace` (#289)
* fix: replace keySP with working KeySpace

* test: update test to meet new reqs

* fix: fix test looking for 'space'

* fix(keys): set type to KeySpace when sending a space

* docs(keys): comments

Co-authored-by: Christian Rocha <christian@rocha.is>
2022-04-12 11:14:35 -04:00
Christian Muehlhaeuser 3795c036c4
add: Exec, ReleaseTerminal and RestoreTerminal to re-use input and terminal (#237)
* add: program.ReleaseTerminal and RestoreTerminal to re-use input & terminal

* chore(examples): add altscreen toggling to exec demo

* chore: put low-level altscreen stuff alongside other screen funcs

* docs: edit GoDocs for ReleaseTerminal and RestoreTerminal

* feat(renderer): add internal Msg renderMsg to immediately repaint

* fix: repaint instantly on RestoreTerminal

* fix: restore the altscreen state when restoring the terminal

* feat: implement Cmd-based API for blocking *exec.Cmds

* feat: allow Exec to return custom messages

* feat: allow Exec to be run without a callback

* fix: separate parameters for exec.Command examples

* fix: error message would get printed over by prompt in exec example

* fix: ignore signals while child process is running

* feat: allow to execute other things besides exec.Commands (#280)

* feat: allow to execute other things besides exec.Commands.

* fix: lint issues

* fix: renames, examples

* fix: callback type should be exported

* docs(exce): tiny ExecCommand doc comment correction

* chore(exec): break out Cmd for clarity's sake in example

* fix(exec): give the terminal a moment to catch up if exiting altscreen

* docs(exec): tidy up doc comments

* chore(exec): disambiguate methods for restoring the terminal state vs input

Co-authored-by: Christian Rocha <christian@rocha.is>
Co-authored-by: Carlos A Becker <caarlos0@gmail.com>
2022-04-12 10:23:10 -04:00
dependabot[bot] ecba57e455 chore(deps): bump actions/setup-go from 2 to 3
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2 to 3.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 12:02:29 +02:00
Christian Muehlhaeuser 515ef02733 Move cancelreader into a separate package 2022-04-05 20:41:21 +02:00
Jared Walters 6b687e3257 docs: remove redundant 'of' 2022-04-03 16:08:36 -04:00
Christian Rocha 9a1310846c docs: Program#Send, Program#Quit, and Program#Kill no longer provisional 2022-03-31 14:38:13 -04:00
Christian Rocha 5c76027b36
feat: add support for function keys 2022-03-21 09:48:05 -04:00
Christian Rocha 442b8cde78 fix: use more bulletproof GetFrameSize() list examples 2022-03-17 16:33:21 -04:00
Christian Muehlhaeuser f80f0b1003 Fix typos in root README.md 2022-03-12 02:17:12 +01:00
Imran H 9bfdb9fb3f
Fix typos in README.md (#254) 2022-03-12 02:08:33 +01:00
dependabot[bot] 00e1e06468 chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-02 10:22:44 +01:00
Christopher Stingl a57af578f0 fix: minor `tea.Cmd` tutorial syntax typo
`errMsg(err)` -> `errMsg{err}`

Just noticed this while reading over the tutorial docs and figured I'd throw up a quick PR to address it.

Really enjoying the tooling so far, thank you for creating it!
2022-02-28 17:20:49 -05:00
Christian Rocha 3b83e703b5 docs: restore fm to its rightful place in the README 2022-02-25 15:16:16 -05:00
Christian Rocha a4ac134e0f docs: add delve instructions 2022-02-25 14:41:27 -05:00
Christian Rocha feeffca0a5 docs: add mergestat, portal, redis-viewer, Soft Serve to in-the-wild 2022-02-25 14:41:27 -05:00
Christian Rocha 572751ab24 docs: alphebetize in-the-wild-section 2022-02-25 14:41:27 -05:00
Roey Darwish Dror e81f6a0552 Add IDNT to Bubble Tea in the Wild 2022-02-25 14:05:01 -05:00
Christian Muehlhaeuser b12cdc3c28 ci: update golangci-lint-action to v3 2022-02-25 08:07:50 +01:00
Carlos Alexandro Becker 62259b72e5
feat: update x/sys (#235)
* feat: update x/sys

current version breaks builds for windows/arm64

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: examples go.sum

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: tutorials go.sum

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2022-02-19 16:25:49 -03:00
dependabot[bot] c9bb51796d chore(deps): bump github.com/charmbracelet/bubbles in /examples
Bumps [github.com/charmbracelet/bubbles](https://github.com/charmbracelet/bubbles) from 0.10.2 to 0.10.3.
- [Release notes](https://github.com/charmbracelet/bubbles/releases)
- [Commits](https://github.com/charmbracelet/bubbles/compare/v0.10.2...v0.10.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-17 07:41:26 -05:00
Christian Rocha 7241e910ec Bump containerd/console 2022-02-15 10:02:56 -05:00
Christian Muehlhaeuser 4d1d1ee021 chore: bump lipgloss and termenv 2022-02-14 23:20:51 +01:00
Christian Muehlhaeuser 2296184dc5 fix: don't check terminal size if we're not writing to a terminal 2022-02-14 17:00:40 -05:00
Christian Muehlhaeuser 6301f93cb2 Support receiving batched mouse events
Mouse events may trigger more than a single events simultaneously.

Fixes #212.
2022-02-13 08:40:04 +01:00
Christian Muehlhaeuser db177f1939
Fix typos in README 2022-02-09 19:27:39 +01:00
Christian Rocha f790a53c28
Readme housekeeping
* Use digitally remastered GIF
* Update footer image
* Add more stuff to the made-with-bubble-tea section
2022-02-09 13:24:39 -05:00
Ayman Bagabas 42cd4c3191 feat: kill the program and restore terminal state
* Add Kill() to force kill the program from the outside
* Prevent renderer channel from being closed multiple times
2022-02-08 10:13:05 -08:00
Christian Muehlhaeuser 74f0972e4e Simplify send-msg example 2022-02-08 18:01:35 +01:00
Christian Muehlhaeuser 7c939e8dfb Use termenv's EnvColorProfile, which respects NO_COLOR and CLICOLOR_FORCE env vars 2022-02-06 04:24:31 +01:00
Carlos Alexandro Becker 9a06319ff1
feat: tea.Batch returns nil if all cmds are nil (#217)
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2022-02-03 12:08:34 -03:00
Ajeet D'Souza a09e0e80cb Add clidle under "Bubble Tea in the Wild" 2022-02-03 06:12:35 +01:00
Carlos A Becker c5d3b1e154
test: test for null cmd in sequentially
refs #214

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2022-02-01 22:53:52 -03:00
Ajeet D'Souza 7d18632ca5
fix: handle nil cmds in tea.Sequentially (#214) 2022-02-01 22:52:49 -03:00
Christian Muehlhaeuser 77e63ac890 Bump termenv to v0.11.0 2022-01-31 23:04:37 +01:00
Christian Muehlhaeuser a6f46172ec Fix source link in Commands tutorial 2022-01-26 02:16:11 +01:00
dependabot[bot] 4f08c1b965 chore(deps): bump github.com/charmbracelet/glamour in /examples
Bumps [github.com/charmbracelet/glamour](https://github.com/charmbracelet/glamour) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/charmbracelet/glamour/releases)
- [Commits](https://github.com/charmbracelet/glamour/compare/v0.4.0...v0.5.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-01-25 08:36:50 -05:00
Ayman Bagabas db5d23b82e
feat: sync bubbletea with git.charm.sh 2022-01-24 17:07:40 -05:00