feat/shimmer text - #1769
Open
Ricardo-M-L wants to merge 2 commits into
Open
Conversation
added 2 commits
July 14, 2026 14:43
Program.Run reads the terminal size once at startup via term.GetSize and trusts the result, checking only the error. Some terminals — tmux is the common case, before the pty size is negotiated — return (0, 0) with no error. Run then resizes the renderer to 0x0 and the event loop, which only paints after a message, renders the first frame into a 0x0 viewport: the whole screen is blank until a real SIGWINCH (a resize or keypress) arrives. This looks like the program hung, and it happens regardless of the model's View() — even a width-agnostic view renders blank because the renderer viewport is 0. Fall back to a standard 80x24 for any zero dimension so the first frame paints; the genuine size still arrives via WindowSizeMsg a moment later and re-renders correctly. Adds fallbackZeroSize + a unit test.
Adds ShimmerMsg/NewShimmer/ShimmerText for character-by-character sweep highlight effects, inspired by Claude Code's TUI. Includes: - ShimmerText: pure function for shimmer rendering - NewShimmer: Cmd for timed tick messages - ShimmerState: convenience state wrapper - examples/shimmer: demo program
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1769 +/- ##
==========================================
+ Coverage 56.34% 57.59% +1.24%
==========================================
Files 25 26 +1
Lines 1315 1408 +93
==========================================
+ Hits 741 811 +70
- Misses 483 504 +21
- Partials 91 93 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a shimmer text animation utility to Bubble Tea v2 — a character-by-character sweep highlight effect inspired by Claude Code's terminal UI.
What's included
ShimmerText()— pure function that renders text with a sweep highlight. Takes progress (0.0-1.0), shimmer color, and optional zone width.NewShimmer()— returns aCmdthat firesShimmerMsgat a configurable interval for easy animation loop integration.ShimmerState— convenience struct that wrapsShimmerText+NewShimmerto eliminate Update/View boilerplate.examples/shimmer/— a runnable demo showing the effect in action.Why
Bubble Tea already has
tea.View,tea.Cmd, andtea.Msg— this adds the missing visual effect primitives that terminal UIs need for polish. Users can use the pureShimmerTextfunction inline or wrap it inShimmerStatefor zero-boilerplate shimmer animations.Design notes
charmbracelet/x/ansifor width calculation\x1b[38;2;R;G;Bm) for smooth shimmer color renderingansi.StringWidth