Commit graph

48 commits

Author SHA1 Message Date
Drew Smirnoff
9c6c325f83
fix: ingnore implausible terminal resize reports (#1887)
Signed-off-by: drew <me@andrinoff.com>
2026-10-26 17:59:16 +04:00
Jason
af9a33e9c4
chore: remove deprecated windows note (#1695)
* remove deprecated windows note

* restart CI

---------

Co-authored-by: drew <me@andrinoff.com>
2026-08-06 16:20:53 +04:00
Ayman Bagabas
0b472523ea
feat: add view callback support
This change replaces the previous hit testing mechanism with a more
flexible callback function in the View struct. This allows views to
handle messages directly, enabling more customizable behavior that is
not limited to mouse hits.
2025-11-20 18:38:59 -05:00
Ayman Bagabas
cfe67248a6
docs: update code example formatting in screen.go 2025-11-14 12:47:43 -05:00
Ayman Bagabas
7120058b79
feat: introduce ModeReportMsg for terminal mode reports 2025-11-13 13:46:02 -05:00
Ayman Bagabas
bd747e7bfa
refactor: clean up redundant code and update testdata 2025-10-01 13:50:38 -04:00
Ayman Bagabas
fb3e0a4a3e
refactor: lean more into the View struct to manage terminal state 2025-10-01 13:50:37 -04:00
Ayman Bagabas
9ef921ab1f
Merge branch 'main' into v2-exp 2025-08-07 11:21:53 -04:00
Yongteng Lei
c30088fd4e
chore: correct DisableBracketedPaste behavior in comment (#1458) 2025-07-28 10:01:06 -04:00
Ayman Bagabas
f1eadf45ea
feat: embed mouse events in hit messages 2025-06-02 13:02:37 -04:00
Ayman Bagabas
1e6aaa5c27
feat: implement hit detection for layers in cursed renderer 2025-06-02 11:41:12 -04:00
Ayman Bagabas
cc204f668b
(v2) fix: windows: enable mouse mode on demand (#1341)
* fix: windows: enable mouse mode on demand

This fixes an issue where mouse mode is always enabled on Windows. With
this patch, we enable mouse events only it is requested.

Needs: https://github.com/charmbracelet/x/pull/386
Related: https://github.com/charmbracelet/bubbletea/issues/1313

* refactor: mouse: properly handle mouse mode

Since mouse mode has a special case on Windows, we now have
separate msg types for mouse events.

* chore: go mod tidy
2025-03-11 16:20:20 -04:00
Ayman Bagabas
3fc1c224d4
chore: merge branch 'main' into v2-exp 2025-02-12 17:03:48 -05:00
Ayman Bagabas
cb6f8402f6
chore: revert "chore: deprecate some StartupOptions in favor of Cmds (#1307)"
This reverts commit 75d1b4b8cf.
2025-02-11 10:29:26 -05:00
Ayman Bagabas
ee7cf45a37
chore: revert "Remove irrelevant option comments"
This reverts commit 439398b1dd.
2025-02-11 10:26:08 -05:00
nervo
439398b1dd Remove irrelevant option comments 2025-02-07 09:09:26 -05:00
Ayman Bagabas
35ecfdd67f
chore: merge branch 'main' into v2-exp 2025-02-04 16:48:43 -05:00
Christian Rocha
75d1b4b8cf
chore: deprecate some StartupOptions in favor of Cmds (#1307) 2025-02-04 15:46:31 -05:00
Ayman Bagabas
26e07ef6bd
fix: typo in screen.go report focus functions 2025-01-28 16:46:45 -05:00
Ayman Bagabas
04c0b438d1
refactor: use the cursed renderer for rendering and remove the standard renderer
This also removes the experimental flags and changes the renderer
interface to be more explicit about the methods that are available.
2025-01-13 08:19:40 +03:00
Ayman Bagabas
1b7743e512 chore: lint issues 2024-11-21 14:12:16 -05:00
Carlos Alexandro Becker
15ce054a43 feat: updating x/ansi (#1235)
* feat: updating x/ansi

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

* fix: enable/disable mode

* fix: execute in private mode, fix tests

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

* fix: update deps

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

* fix: test

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

* feat: update cellbuf

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

* all the updates

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

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-11-21 14:12:16 -05:00
Ayman Bagabas
baecd89ed6
chore: merge branch 'main' into v2-exp 2024-10-24 11:19:25 -04:00
Ayman Bagabas
a7d49d01a4
chore: remove deprecated 2024-09-19 13:21:00 -04:00
Ayman Bagabas
614aa93d2c fix: renderer: don't return a Cmd on update 2024-09-12 11:54:01 -04:00
Ayman Bagabas
0fe006d28f feat: use the new renderer interface 2024-09-12 11:54:01 -04:00
Ayman Bagabas
e58efab371
feat: support focus-blur events (#1122)
* feat: support focus-blur events

This backports @caarlos0 focus-blur changes from v2-exp to v1 https://github.com/charmbracelet/bubbletea/pull/1081

Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* Update key_sequences.go

Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: go mod tidy

---------

Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Christian Rocha <christian@rocha.is>
2024-08-30 09:20:01 -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
05f8399a93
feat: dry setting and retrieving terminal modes
Use Mode/SetMode instead of EnableAltScreenBuffer/DisableAltScreenBuffer
etc. This uses less code and makes it more usable in the future to
accommodate for more terminal capabilities and modes.
2024-08-21 16:02:02 -04:00
Ayman Bagabas
1f88b9ed6e
refactor: simplify renderer interface
Use Render instead of Write/WriteString
2024-08-20 17:11:04 -04:00
Ayman Bagabas
6f7f9e6492
feat: expose the renderer interface
This adds the ability to use a custom renderer using a modified version
of the existing `renderer` interface.
2024-08-20 12:14:59 -04:00
Carlos Alexandro Becker
3e87bf8e62
feat: add Enable/Disable focus report commands
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-08-13 22:25:28 -03:00
Ayman Bagabas
7a49b33ec5
refactor: define renderer execute to write queries to the terminal
This replaces enable/disable directives with exception to alt-screen and
cursor visibility since those affect the renderer.
2024-08-13 11:17:04 -04:00
Ayman Bagabas
eb78a8cf6a
fix: program renderer commands (#1030)
Using program commands like p.EnableMouseCellMotion and p.SetWindowTitle
_before_ the program starts can panic the application since `renderer`
hasn't been initialized yet. Use program options to enable and set these
options if `renderer` is not initialized.

Fixes: https://github.com/charmbracelet/bubbletea/issues/1029
2024-05-30 14:28:24 -04: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
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
2bcb0af2e2
feat: add set-window-title command (#611)
Set the terminal window title using termenv.

Fixes: https://github.com/charmbracelet/bubbletea/issues/610
2023-12-04 11:50:27 -05:00
Josh Soref
4aa9ce489b
docs: fix spelling / various typos (#526) 2022-10-11 14:40:01 +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
e4ca150210 chore: reorganize screen commands & messages 2022-10-04 05:20:07 +02:00
Christian Muehlhaeuser
6c449e55bf feat: use Termenv.Output to write to tty 2022-09-27 02:49:36 +02: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
Christian Rocha
6d70abd7d5 When showing/hiding the cursor operate on the program's io.Writer
Previously we were operating on io.Stdout.
2020-12-03 13:56:37 -05:00
Christian Rocha
00f7f5be93
Remove cursor save/restore as it was wrecking things
Also, um, we didn't need it.
2020-06-18 20:10:20 -04:00
Christian Rocha
8539cfcf8c
Fix a bug where left area on the first line was not always cleared 2020-06-17 14:50:39 -04:00
Christian Rocha
090c983bd5
Bump termenv and futher integrate it into terminal controls 2020-06-17 11:17:41 -04:00
Christian Rocha
683473c26d
Blind pass at adding high performance scrolling into the renderer 2020-06-16 22:06:46 -04:00