Commit graph

131 commits

Author SHA1 Message Date
Drew Smirnoff
585149e50e
fix: drain terminal query replies before releasing the terminal (#1894)
Signed-off-by: Drew Smirnoff <drew@charm.land>
2026-11-20 19:01:53 +04:00
Meng Yan
b681f23559
fix(renderer): flush queued view before insert above (#1741)
Co-authored-by: Drew Smirnoff <drew@charm.land>
Signed-off-by: Meng Yan <yanmxa@gmail.com>
Signed-off-by: Drew Smirnoff <drew@charm.land>
2026-11-20 18:56:54 +04:00
draw me an elephant
7ab4335dac
fix: don't panic on uncomparable color.Color values (#1852)
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Drew Smirnoff <drew@charm.land>
Signed-off-by: Drew Smirnoff <drew@charm.land>
2026-11-20 18:33:00 +04:00
jane michelle arc
4853fdaaa0
fix(renderer): skip redraws when empty or tall views haven't changed (#1897) 2026-11-18 11:40:20 +04:00
jane michelle arc
8675fd8a85
fix: restore unicode mode on resume (#1896) 2026-11-18 11:31:36 +04:00
Morax
6b30ecf328
fix(renderer): use view height before first flush (#1766)
Co-authored-by: Drew Smirnoff <drew@charm.land>
Signed-off-by: Drew Smirnoff <drew@charm.land>
2026-11-12 17:45:21 +04:00
Gurdeep
94d45c807d
fix(renderer): prevent emitting stale frame on resize (#1856)
Co-authored-by: Drew Smirnoff <drew@charm.land>
Signed-off-by: Gurdeep <gurdeepdalal05@gmail.com>
Signed-off-by: Drew Smirnoff <drew@charm.land>
2026-11-12 17:39:48 +04:00
Sanjay Santhanam
df137dee9a
fix: measure insertAbove lines with the active width method (#1861)
Co-authored-by: Drew Smirnoff <drew@charm.land>
Signed-off-by: Drew Smirnoff <drew@charm.land>
2026-11-12 17:30:31 +04:00
赵鑫亿
9806b0c763
fix(exec): clear View before releasing terminal for subprocess (#1762)
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Drew Smirnoff <drew@charm.land>
2026-11-12 17:23:45 +04:00
Harjot Singh
bd09ae6834
fix: preserve exact-width lines printed above the view (#1888)
Co-authored-by: Drew Smirnoff <drew@charm.land>
2026-11-12 17:21:47 +04:00
Viktor Danov
e4d617e7e0
perf(renderer): stop the frame ticker while nothing changes (#1832)
Co-authored-by: Drew Smirnoff <drew@charm.land>
Signed-off-by: Drew Smirnoff <drew@charm.land>
2026-11-09 14:55:22 +04:00
Drew Smirnoff
41bc626564
feat: OSC 7501 (#1841)
Signed-off-by: drew <me@andrinoff.com>
2026-10-08 21:36:08 +04:00
deepakganesh78
0d3e281d14
fix: restore kitty keyboard stack on exit (#1750)
Co-authored-by: drew <me@andrinoff.com>
Signed-off-by: drew <me@andrinoff.com>
2026-08-19 15:56:33 +04:00
Drew Smirnoff
faf4dcf54a
fix: pendingErase in cursedRenderer (#1755)
Signed-off-by: drew <me@andrinoff.com>
2026-08-18 11:32:34 +04:00
Liam Stanley
c60f0c5304
fix: prevent data race with cursedRenderer.onMouse (#1691)
- closes #1690
- adds `-race`, `-count`, and `-cpu`
- make all viable tests parallel

Signed-off-by: Liam Stanley <liam@liam.sh>
2026-05-11 21:11:40 -04:00
Ayman Bagabas
ac355fe194
fix(renderer): restore tab stops if hard tabs are enabled (#1677)
When hard tabs are enabled, we optimize rendering by using actual tab
characters instead of spaces. This requires us to set tab stops every 8
columns at the beginning of the rendering process.

Fixes: https://github.com/charmbracelet/bubbletea/issues/1614
2026-04-13 10:28:52 -04:00
Ayman Bagabas
05df5aecf8
feat: support extended keyboard enhancements (#1626)
This adds support for the Kitty keyboard protocol's extended
enhancements, allowing applications to request that the terminal report
additional information about key events, such as whether they're part of
a repeat sequence, alternate key values, and associated text.

Supersedes: https://github.com/charmbracelet/bubbletea/pull/1622
Fixes: https://github.com/charmbracelet/bubbletea/issues/1621
Fixes: https://github.com/charmbracelet/bubbletea/issues/1623
2026-04-07 11:03:32 -04:00
Ayman Bagabas
faa0b9c36b
fix: lint issues 2026-02-23 23:15:30 +03:00
Ayman Bagabas
742b944f78
feat(render): enable Unicode mode (2027) for accurate width calculation (#1584)
When the terminal supports it, we now enable Unicode mode (ANSI mode
2027) to ensure accurate width calculation for wide characters and
emojis. This improves rendering fidelity in terminals that support this
mode.
2026-02-13 15:36:47 +03:00
Ayman Bagabas
6595041da2
fix(renderer): no need to enable both modifyOtherKeys protocols 2026-02-10 15:14:14 +03:00
Ayman Bagabas
30878e43d7
chore: upgrade ultraviolet to the latest version 2026-02-09 10:46:36 +03:00
Ayman Bagabas
1f48289368
feat(renderer): enable both modifyOtherKeys 1 and 2 2026-02-09 10:35:07 +03:00
Erik St. Martin
724479d6d5
feat(renderer): add modifyOtherKeys support (#1579)
Modified keys (shift+enter, ctrl+i, etc.) don't work in tmux because
tmux doesn't support the Kitty keyboard protocol. tmux requires
applications to request extended-keys using modifyOtherKeys (CSI > 4 ; 2 m).

The workaround is setting 'extended-keys always' in tmux config (tmux 3.2+),
but users may not know this is the issue, and forcing extended-keys for all
applications may not be desired. This fix sends modifyOtherKeys requests
alongside Kitty protocol sequences, enabling proper key handling in tmux
automatically.
2026-02-09 09:56:52 +03:00
Ayman Bagabas
61a3f5ccf8
fix(render): execute insert above immediately (#1576)
This commit modifies the behavior of the `insertAbove` method in the
renderer to execute the insertion of lines immediately rather than
queuing them for later processing. This change ensures that lines are
inserted above the current view without delay.
2026-02-05 12:46:27 +03:00
Ayman Bagabas
819e2e89c6
fix(renderer): flush after moving cursor on close 2025-12-16 10:33:12 -05:00
Ayman Bagabas
99c33bc300
fix(renderer): move cursor to bottom before disabling alt screen
Fixes: fdb86513b5 (fix(renderer): always move cursor to bottom on close)
2025-12-16 10:01:07 -05:00
Ayman Bagabas
fdb86513b5
fix(renderer): always move cursor to bottom on close
Fixes: https://github.com/charmbracelet/crush/pull/1592
2025-12-16 09:46:49 -05:00
Ayman Bagabas
9e01328aa1
chore: bump ultraviolet to control renderer scroll optimization 2025-12-10 15:40:18 -05:00
Ayman Bagabas
59807cf07c
fix(renderer): reset kitty keyboard protocol on alt screen switch (#1554)
* fix(renderer): reset kitty keyboard protocol on alt screen switch

We need to reset the kitty keyboard protocol when switching between main
and alt screens. This is because kitty maintains separate keyboard
protocol registries for each screen, and failing to reset the protocol
can lead to issues such as the inability to use the Ctrl key in some
editor that don't support kitty's keyboard protocol.

* chore: update golden files to match the renderer output
2025-12-10 15:37:12 -05:00
Ayman Bagabas
2a0096c500
fix(renderer): restore state when restarting cursed renderer (#1553)
When the cursed renderer is stopped and then started again, we need to
restore some state to ensure it functions correctly. This commit
introduces a flag to track when the renderer is starting up again after
being stopped. When this flag is set, we bypass the optimization that
skips rendering if there are no changes, ensuring that the renderer
properly redraws the screen.

One example is when tea.Exec is used to run a program that stops the
renderer and then starts it again. Without this fix, the renderer will
do nothing and print an empty screen until it needs to like when it
receives an update that changes the view.
2025-11-26 17:07:03 -05:00
Ayman Bagabas
fb790535cc
fix(renderer): make sure we don't skip prepended lines on no-op frames 2025-11-24 10:54:15 -05:00
Ayman Bagabas
d1cf96d0d3
refactor: limit view callback to onMouse for mouse events 2025-11-24 10:34:05 -05: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
4687350583
fix: renderer: check for cellbuf size change before skipping flush 2025-11-16 15:28: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
513313125a
fix: renderer: always erase to end of line when prepending lines 2025-11-14 16:49:42 -05:00
Ayman Bagabas
03b65248bf
fix: edge case where cursor visibility is the only change 2025-11-14 14:35:01 -05:00
Ayman Bagabas
d88ab58421
feat: renderer: use uv altscreen helpers 2025-11-14 10:57:16 -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
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
f1799cdf05
feat: add synchronized updates option to renderer interface 2025-11-13 13:48:55 -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
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
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