Commit graph

1769 commits

Author SHA1 Message Date
Ayman Bagabas
95e366c689
fix(renderer): debounce resize renders
This change introduces a debounce mechanism to the cursed renderer's
resize handling. When a resize event occurs, the renderer will now wait
for a short duration before processing the resize. This prevents
multiple full resize renders from occurring in quick succession, which
can lead to performance issues and visual artifacts.
2025-11-24 11:20:32 -05:00
Ayman Bagabas
15f884bd29
Merge pull request #1546 from charmbracelet/v2-tear
v2: fix: renderer: delay redraw on resize
2025-11-17 11:10:17 -05:00
Ayman Bagabas
4687350583
fix: renderer: check for cellbuf size change before skipping flush 2025-11-16 15:28:26 -05:00
Ayman Bagabas
6483c7e3ae
chore(tests): update golden files 2025-11-16 14:55:49 -05:00
Ayman Bagabas
42f01c6c2b
chore: bump ultraviolet dependency to latest 2025-11-16 14:53:26 -05:00
Ayman Bagabas
f206009f44
fix: renderer: always redraw on resize
This to avoid visual artifacts on some race obscure cases when resizing
the terminal window.
2025-11-16 14:51:40 -05:00
Ayman Bagabas
83e606b3d0
fix: renderer: handle cursor visibility and syncd output efficiently
This change improves the handling of cursor visibility updates and
synchronized output mode in the terminal renderer. It ensures that
cursor visibility changes are only applied when necessary, reducing
flickering and unnecessary terminal control sequences.

Fixes: 55b3503a2a (Merge pull request #1542 from charmbracelet/charm-853-cursor-flash-interruptions-mode-2026)
2025-11-16 12:50:42 -05:00
Ayman Bagabas
f19cb6850a
fix: renderer: defer resize and draw until flush
Since we run the event loop and the render loop in different goroutines,
sometimes they can get out of sync. When a resize happens, the event
loop resizes the screen buffer, however, the render loop may not have
flushed the previous frame yet. This can lead to rendering issues where
the screen buffer is not the correct size for the new frame causing
artifacts.
2025-11-16 12:48:11 -05:00
Ayman Bagabas
f60735dff1
chore: bump dependencies 2025-11-16 11:39:36 -05:00
Ayman Bagabas
55b3503a2a
Merge pull request #1542 from charmbracelet/charm-853-cursor-flash-interruptions-mode-2026
v2: Support mode 2026 (synchronized output updates)
2025-11-14 16:59:30 -05:00
Ayman Bagabas
1ef7dd4589
fix: ensure TERM_PROGRAM is set
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-14 16:51:43 -05:00
Ayman Bagabas
513313125a
fix: renderer: always erase to end of line when prepending lines 2025-11-14 16:49:42 -05:00
Ayman Bagabas
6dfb88719d
chore: bump ultraviolet to 20251114211315-f6a8e3732033 2025-11-14 16:14:24 -05:00
Ayman Bagabas
78766cd0ca
fix(examples): use updated progress bar blend api 2025-11-14 14:46:54 -05:00
Ayman Bagabas
03b65248bf
fix: edge case where cursor visibility is the only change 2025-11-14 14:35:01 -05:00
Copilot
ed050cd108
refactor: extract terminal capability detection into helper function (#1543)
Co-authored-by: aymanbagabas <3187948+aymanbagabas@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2025-11-14 14:25:54 -05:00
Ayman Bagabas
9878b7a536
docs: update NewView and SetContent to add examples and notes 2025-11-14 12:52:41 -05:00
Ayman Bagabas
cfe67248a6
docs: update code example formatting in screen.go 2025-11-14 12:47:43 -05:00
Ayman Bagabas
befc5a4e93
chore: bump dependencies to use uv helpers 2025-11-14 12:45:37 -05:00
Ayman Bagabas
d88ab58421
feat: renderer: use uv altscreen helpers 2025-11-14 10:57:16 -05:00
Ayman Bagabas
39f38b1640
Merge branch 'v2-exp' into charm-853-cursor-flash-interruptions-mode-2026 2025-11-14 10:33:01 -05:00
Ayman Bagabas
fa796c98c0
chore: update testdata for cursor hide/show changes 2025-11-14 10:32:36 -05:00
Ayman Bagabas
2c7af7f201
fix: renderer: avoid redundant cursor toggles
When synchronized output is not supported or not enabled, we don't
need to wrap updates with cursor hide/show sequences if the cursor
is already hidden.
2025-11-14 10:30:35 -05:00
Ayman Bagabas
8f17c3584f
fix(examples): revert textarea pointers to values
Fixes: 6a65a1f (chore(docs): update examples and dependencies for v2-exp)
2025-11-13 16:40:47 -05:00
Ayman Bagabas
a74936a850
chore(tests): fix tests and update testdata 2025-11-13 14:46:50 -05:00
Ayman Bagabas
b1241c920a
chore(examples): go mod tidy 2025-11-13 13:59:29 -05:00
Ayman Bagabas
c3c752dbf7
refactor: renderer: support mode 2026, manage cursor visibility and altscreen
Adds support for terminal mode 2026 sequences and reintroduces cursor
visibility and alt screen management in the Bubble Tea cursed renderer.

The latest changes from the UV renderer drop cursor visibility and alt
screen management. This commit reintroduces that logic into the Bubble
Tea cursed renderer to ensure proper behavior when switching between alt
screen modes and managing cursor visibility.

It also tries to optimize updates and remove redundant state changes.
2025-11-13 13:50:17 -05:00
Ayman Bagabas
349783e879
feat: query terminal for synchronized output support (mode 2026) 2025-11-13 13:49:33 -05:00
Ayman Bagabas
f1799cdf05
feat: add synchronized updates option to renderer interface 2025-11-13 13:48:55 -05:00
Ayman Bagabas
7120058b79
feat: introduce ModeReportMsg for terminal mode reports 2025-11-13 13:46:02 -05:00
Ayman Bagabas
39e9984571
chore: bump dependencies for v2-exp 2025-11-12 11:31:08 -05:00
Ayman Bagabas
f01fc811bc
fix: renderer: reset cursor position in inline mode to avoid line wraps 2025-11-12 11:02:35 -05:00
Ayman Bagabas
3a71934c73
fix: renderer: ensure prepended lines queued before render 2025-11-12 11:02:09 -05:00
Ayman Bagabas
94247ed8f1
feat: add SupportsKeyDisambiguation to KeyboardEnhancementsMsg 2025-11-12 10:59:13 -05:00
Ayman Bagabas
3780c0e8b1
docs: update keyboard enhancement flags comment 2025-11-12 10:57:19 -05:00
Ayman Bagabas
f952eb953a
fix: renderer: use an interface for inline height calculation 2025-11-06 15:42:35 -05:00
Ayman Bagabas
aa0071e72d
fix: renderer: we want to always use the frame area for drawing 2025-11-06 15:41:16 -05:00
Ayman Bagabas
579e174cd7
chore: bump dependencies for v2-exp 2025-11-06 14:59:25 -05:00
Ayman Bagabas
06c0cda318
chore: bump ultraviolet to include recent changes 2025-11-06 14:20:06 -05:00
Ayman Bagabas
a1ecb94bda
refactor: rename View.Layer to View.Content for clarity (#1536) 2025-11-06 13:57:47 -05:00
Ayman Bagabas
f03c467c1b
refactor: keyboard enhancements api improvements (#1534) 2025-11-06 12:22:22 -05:00
Ayman Bagabas
d9f7210a9e
fix(renderer): avoid unnecessary resize on alt screen buffer
When rendering to the alternate screen buffer, avoid resizing the screen
buffer to avoid potential rendering issues. The alternate screen buffer
always follows the terminal size, so resizing is unnecessary and can lead
to visual glitches.

Fixes: https://github.com/charmbracelet/crush/issues/1389
2025-11-06 11:47:30 -05:00
Ayman Bagabas
3138f1cd1b
chore: bump ultraviolet and colorprofile dependencies 2025-11-05 13:22:44 -05:00
Ayman Bagabas
db021e2f6d
chore: test: add benchmark for tea Run method 2025-11-05 12:47:35 -05:00
Ayman Bagabas
514da28df3
perf: renderer: skip flush if no changes
This theoretically should improve performance in cases where the view is
not changing between flushes, such as when idle or waiting for input.
However, basic benchmarks do not show a significant difference, so
further investigation may be needed to confirm its effectiveness.
2025-11-05 12:42:17 -05:00
Ayman Bagabas
1dcdea988c
fix: renderer: use the correct size when resizing the screen 2025-11-05 12:13:17 -05:00
Ayman Bagabas
101fd110a0
Revert "fix: renderer: sync buffer resize with frame rate"
This reverts commit d7c95b8a27.
2025-11-05 12:12:38 -05:00
Ayman Bagabas
cc0168c65e
refactor: migrate imports to charm.land domain 2025-11-04 15:04:06 -05:00
Ayman Bagabas
ff8c8247c5
docs(examples): migrate imports to charm.land 2025-11-04 14:59:01 -05:00
Ayman Bagabas
842bea3315
chore: update example go.mod and go.sum to use new charm.land module path 2025-11-04 14:58:49 -05:00