Open
Conversation
The tail command previously used raw ANSI escape codes (\033[2J\033[H) to clear and redraw the screen on each refresh. This caused unbounded scrollback growth in most terminal emulators, making it unusable for long monitoring. Now uses a Bubble Tea program with tea.WithAltScreen(), which renders in the alternate screen buffer (like top/htop/watch). This completely eliminates scrollback pollution, adds proper terminal resize handling, and provides clean exit with q/esc/ctrl+c. Also adds terminal-height-aware truncation so the view fits the screen, and adapts title width to terminal width. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
ty tailfrom raw ANSI escape codes to a Bubble Tea program withtea.WithAltScreen()top/htop/watch)q/esc/ctrl+cinstead of onlyctrl+cWhat changed
The old implementation used
\033[2J\033[H(clear screen + cursor home) on each 2s refresh, which pushed content into the terminal's scrollback buffer on every cycle. After a few minutes, the scrollback would be enormous.The new implementation uses Bubble Tea's alternate screen mode, which is the standard approach used by
top,htop,watch, and other terminal monitoring tools. Content is rendered in a separate buffer that doesn't affect scrollback at all. On exit, the terminal returns to its previous state cleanly.Test plan
tailModel(Update + View): key handling, window resize, tick scheduling, task rendering, height truncation, done task filteringty tailand verify no scrollback growth🤖 Generated with Claude Code