Commit graph

11 commits

Author SHA1 Message Date
Ayman Bagabas
cb090c0aed
fix: lint: use isWindows() helper function 2025-05-01 11:53:10 -04:00
Ayman Bagabas
9087113343
feat,refactor!: introduce cursor model (#1303)
This introduces a new `CursorModel` interface that can be implemented by
the main model to provide a cursor position and style. A nil cursor will
hide the cursor. Otherwise, the cursor will be shown at the position and
with the style specified. Use `NewCursor` to quickly create a cursor for
a given position with default styles. This method is called in-sync with
the `Model.View` method.

It also removes the previously introduced `Frame` type and `NewFrame`
function. The main model can now return a `string` to render the program's
UI. The main model can return a `Cursor` to set the cursor position and
style.

The old `Init` method is now back and it returns a `Cmd` instead of a
both a `Model` and a `Cmd`. This is to make the mental model more straight
forward, and to keep things backwards compatible.
2025-02-04 12:47:23 -05:00
Ayman Bagabas
d93aa0090d
refactor!: model stringer interface 2025-01-23 14:58:43 -05:00
Ayman Bagabas
023af98640
feat: add Frame type and remove cursor commands
This commit introduces a new `Frame` type that represents a single frame of
the program's output. The `Frame` type contains the frame's content and cursor
settings. The cursor settings include the cursor's position, style, blink, and
visibility.

It also removes the cursor commands from the `tea` package. The cursor
commands are now part of the `Frame` type. The cursor commands were removed
because they were not idiomatic and were not flexible enough to support
additional cursor settings.

Supersedes: https://github.com/charmbracelet/bubbletea/pull/1293
2025-01-23 14:57:54 -05:00
Ayman Bagabas
9f6f5cd193 chore: merge branch 'main' into v2-exp 2024-10-21 12:37:45 -04:00
Ayman Bagabas
cd1e4d34a7 fix: exec tests on windows
Windows doesn't have true/false binaries
2024-10-20 21:45:53 -07:00
Ayman Bagabas
c35932f7ba fix(windows): test cases on windows 2024-10-15 18:49:46 -07:00
Ayman Bagabas
ad68c4205f
feat!: make Init return the model (#1112) 2024-08-23 16:21:21 -04:00
Christian Muehlhaeuser
13cdfd2719 test: exec returning an error for invalid and failing commands 2022-10-09 03:46:59 +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
5c8eb85b69 test: exec binary from within tea.Program 2022-09-27 09:16:00 +02:00