Commit graph

67 commits

Author SHA1 Message Date
Ayman Bagabas
ff8c8247c5
docs(examples): migrate imports to charm.land 2025-11-04 14:59:01 -05:00
Ayman Bagabas
eecd88792a
docs: update examples to use the new api 2025-10-14 12:12:09 -04:00
Ayman Bagabas
f58ca7a91e
chore(examples): simple: disable test temporarily 2025-10-01 14:09:13 -04:00
Ayman Bagabas
20b1d5def3
chore: update examples to use tea.View 2025-10-01 13:50:44 -04:00
Ayman Bagabas
f2d8c4d1e4
chore: update examples and api 2025-10-01 13:50:43 -04:00
Ayman Bagabas
c50f8089f2
Merge branch 'main' into v2-exp 2025-09-11 15:04:36 -04:00
Ayman Bagabas
28ab4f41b2
fix(renderer): properly reset cursor position to start of line (#1472)
This change uses carriage return (`\r`) instead of moving the cursor
backward by the terminal width at the end of rendering in inline mode.
With this, we don't need to know the terminal width to reset the cursor
position, which avoids issues when the renderer doesn't yet know the
terminal width (e.g. the first render where the size message hasn't been
sent to the renderer yet).

Fixes: https://github.com/charmbracelet/bubbletea/issues/1471
2025-09-05 10:37:47 -04:00
Ayman Bagabas
51804bc5f6
fix(examples): ensure we have a newline at the end of the simple example 2025-08-13 15:21:46 -04:00
Ayman Bagabas
3fc1c224d4
chore: merge branch 'main' into v2-exp 2025-02-12 17:03:48 -05:00
Ayman Bagabas
47166e9a7a
chore: remove trailing newlines and update testdata
The new renderer now always moves the cursor to the beginning of
the next line on exit.
2025-02-10 17:02:33 -05:00
Ayman Bagabas
771a101562
fix: renderer: use newline instead of cud1 to move cursor down (#1323)
* fix: renderer: use newline instead of cud1 to move cursor down

Using cud1 (`\x1b[B`) won't scroll the terminal if the cursor is already
at the bottom of the screen. Instead, use a newline character to move
the cursor down and scroll the terminal if necessary.

Fixes: https://github.com/charmbracelet/bubbletea/issues/1322

* chore(examples): update tesdata
2025-02-10 16:21:20 -05:00
Christian Rocha
06e7f63413
docs(examples): update various examples per v2 changes 2025-02-04 16:17:44 -05:00
Ayman Bagabas
55f6f9f70b
chore(examples): update examples 2025-01-23 15:42:03 -05:00
Ayman Bagabas
26be4d4138
feat: tests: use golden files to test screen sequences 2025-01-13 08:20:20 +03:00
Ayman Bagabas
d4add5db79
chore: merge branch 'main' into v2-exp 2024-12-12 13:37:03 -05:00
Ayman Bagabas
857823478f chore: bump ansi to v0.6.0 2024-12-10 12:42:11 -05:00
Ayman Bagabas
b7a3c35132 feat: make the ferocious renderer opt-in
The ferocious renderer is now opt-in. This commit adds a new option
`WithFerociousRenderer` that enables the ferocious renderer.
2024-11-12 16:42:38 -05:00
Ayman Bagabas
0b77768403
fix(examples): skip simple interactive test 2024-11-12 12:22:13 -05:00
Ayman Bagabas
a2c8b388d9
chore: merge branch 'main' into v2-exp 2024-11-05 10:57:44 -05:00
Konstantin Antonov
3dfbcd9c9b feat(render): skipping lines from previous frame 2024-10-30 09:43:53 -04:00
Konstantin Antonov
e44d9c6af2 update golden output 2024-10-30 09:43:53 -04:00
Ayman Bagabas
8e990207da
fix: skip test that fails due to color profile 2024-10-28 16:24:19 -04:00
Ayman Bagabas
43b11c30b3 fix: make grapheme clustering opt-in
This commit changes the behavior of grapheme clustering to be opt-in
instead of opt-out. This is because some terminals like Apple Terminal
don't support DECRQM and DECRPM, which are required for querying and
setting the grapheme clustering state.

Apple Terminal, instead, replies with a `p` character when querying the
grapheme clustering state, which is not a valid response and breaks the
program output.
2024-10-22 21:55:07 -04:00
Ayman Bagabas
e812e941e7
fix: examples: update examples to use tea.KeyPressMsg and tea.MouseClickMsg 2024-10-11 11:53:41 -04:00
Ayman Bagabas
1678d85ce2
feat: use bubbles/v2 and bubbletea/v2 in examples and tutorials 2024-09-18 14:21:14 -04:00
Ayman Bagabas
3650670bdb
fix: reset terminal colors on exit using osc 110/111/112 2024-09-16 14:20:18 -04:00
Ayman Bagabas
4fa1f0608c
fix: terminal colors tests 2024-09-12 14:58:24 -04:00
Ayman Bagabas
ee120d5542
chore: update examples to use v2-exp 2024-09-12 11:39:54 -04:00
Ayman Bagabas
b2e983a1f1
feat: add mode 2027 grapheme clustering stubs (#1105)
* feat: add mode 2027 grapheme clustering stubs

This adds the necessary stubs to make mode 2027 (grapheme clustering)
work on Bubble Tea with renderers that support it.

* fix: screen grapheme clustering tests
2024-08-23 15:17:24 -04:00
Ayman Bagabas
356c649672
fix(examples): update testdata 2024-08-21 16:03:55 -04:00
Ayman Bagabas
4497aa9eef
fix: reset cursor position on renderer exit (#1058)
We need to reset the cursor position to the beginning of the line when
the program stops or exit.

Related: https://github.com/charmbracelet/gum/issues/607
2024-07-16 12:54:58 -04:00
Carlos Alexandro Becker
ea13ffb9a1
feat: allow to suspend bubbletea programs (#1054)
* feat: allow to suspend bubbletea programs

closes #497
closes #1053

* fix: typo

* fix: move things around, add example

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

* fix: block until CONT

* fix: ResumeMsg

* docs: improve example

* docs: one more example

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

* fix: examples tests

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

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-07-11 18:05:16 -03: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
Ayman Bagabas
8028edee96 fix: update examples testdata 2024-05-08 16:07:42 -04:00
Ayman Bagabas
a6f77ff8cd
chore(examples): use lipgloss everywhere possible (#963)
Lip Gloss abstracts away the color profiles logic and results in less
lines
2024-03-22 13:55:19 -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
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
b2d2ac6504
chore: update example tests, test on ci (#735)
* chore: update example tests, test on ci

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

* fix: mark *.golden as binary

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

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-06-09 09:17:15 -03:00
Carlos Alexandro Becker
25022e9789
example: using the x/exp/teatest package (#352)
teatest was originally designed in this PR, and was later moved into `github.com/charmbracelet/x`.

* docs: example test

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

* feat: teatest

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

* fix: improve api

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

* fix: improve api

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

* feat: goldenfiles

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

* chore: minor improvements

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

* feat: type text, diff

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

* fix: release terminal

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

* fix: lint

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

* fix: update cancelreader

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

* fix: make it safe

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

* feat: functional options

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

* feat: IsQuit and IsQuitMsg

* fix: save file

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

* fix: do not use deprecate func

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

* fix: make diff not complain about trailing whitespaces

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

* feat: with term size

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

* feat: RequireRegexOutput

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

* fix: update

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

* chore: rename

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

* fix: improve reliability

* fix: use returned model

* fix: making it more predictable, avoid sleeps

* fix: remove WithRequiredRegexpOutput

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

* fix: allow to assert within interactions

* feat: added wait for

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

* fix: optional

* feat: improve usage

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

* fix: use udiff

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

* feat: tea.Wait

wait for the underlying context to finish.

extract from #352

* fix: merge

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

* fix: wait til the end of shutdown

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

* fix: final output

* feat: use x/exp/teatest

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

* chore: go mod tidy

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

---------

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-05-05 16:14:26 -03:00
Glenn Gonda
4880cf2a09 docs: fix typos and clean up comments 2023-02-19 08:45:22 -05: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
Maas Lalani
d20732aaea docs: add examples/gifs locally to repository 2022-10-03 15:07:28 -04: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
Ilya Revenko
29b7de4b7c
Fix more typos in examples (#102) 2021-05-28 19:45:17 +02:00
Christian Rocha
7c0bbc7d32 Clean up and normalize examples 2021-05-01 09:33:13 -04:00
Christian Muehlhaeuser
b6c7f93d9a Fix various typos in examples 2021-03-12 02:16:41 +01:00
Christian Rocha
141fc86ad0
Update wording in simple example 2020-10-15 20:51:28 -04:00
Christian Rocha
847787e46d
Convert remaining examples to Model interface-based structure 2020-10-15 19:48:42 -04:00
Christian Rocha
816428c135
Add comment for Init() in simple example 2020-10-15 16:19:13 -04:00