Commit graph

1794 commits

Author SHA1 Message Date
Ayman Bagabas
50d023dc52
perf: combine event and render loops into single loop
This simplifies the program's main loop by merging the event handling
and rendering processes. This change reduces complexity and potential
synchronization issues, leading to improved performance and
maintainability.
2026-01-13 14:58:43 -05:00
Ayman Bagabas
7ae2c09f32
chore(examples): update lipgloss to v2.0.0-beta.3.0.20251205162909-7869489d8971 2026-01-13 14:58:31 -05: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
6348bd4b74
chore: bump uv to fix non en lang rendering issues
Fixes: https://github.com/charmbracelet/crush/issues/1613
2025-12-12 14:41:16 -05:00
Ayman Bagabas
7adbf082fd
chore: remove local replace directive for ultraviolet module 2025-12-11 21:25:30 -05:00
Ayman Bagabas
9ed8357ca9
chore: bump dependencies for v2-exp 2025-12-11 14:57:57 -05:00
Ayman Bagabas
3f03681120
chore: bump ultraviolet to fix scroll empty line bug 2025-12-10 18:34:56 -05:00
Ayman Bagabas
69636dd062
chore: bump ultraviolet to fix cursor movement issue that cause artifacts 2025-12-10 17:31:39 -05:00
Ayman Bagabas
c50235b46f
chore: remove local replace of ultraviolet in examples go.mod 2025-12-10 17:15:02 -05:00
Ayman Bagabas
4e524db2ae
chore: remove local replace of ultraviolet module 2025-12-10 16:53:14 -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
5fa38b798f
chore: bump ultraviolet to fix rendering issues with unnecessary cursor
movements and erasing line background color
2025-12-02 11:23:39 -05:00
Ayman Bagabas
551c60ee5a
chore: bump dependencies 2025-12-01 13:41:11 -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
ec0d820c34
fix(tea): only send actual mouse events to renderer on mouse callback 2025-11-26 12:55:45 -05:00
Ayman Bagabas
5de0f1f675
Merge pull request #1549 from charmbracelet/v2-callback
v2: feat: make view content a string and add view callback support
2025-11-24 13:43:13 -05:00
Ayman Bagabas
ba8f605823
fix: go.mod and go.sum to use lipgloss v2 2025-11-24 12:10:14 -05:00
Ayman Bagabas
e02ba76901
chore(examples): update to bubbletea v2 onMouse callback 2025-11-24 10:58:40 -05:00
Ayman Bagabas
46b608f152
docs: update OnMouse callback to use msg parameter 2025-11-24 10:54:35 -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
e78528df79
chore(examples): update clickable example to use v2 callback for layer hit detection 2025-11-20 18:46:00 -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
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