feat(cli): clear only previous graph in realtime mode#79
Merged
guptarohit merged 2 commits intoJun 19, 2026
Merged
Conversation
- Add lastGraphLines to track previous graph height - Add clearPreviousGraph function to clear only previous graph lines instead of clearing entire screen - This improves realtime plotting by reducing screen flicker Fixes guptarohit#44
Erase only the previous graph's lines instead of wiping the whole screen, fixing the realtime cursor drift and preserving output above the graph.
0584151 to
66346cb
Compare
Merged
guptarohit
added a commit
that referenced
this pull request
Jun 21, 2026
🤖 I have created a release *beep* *boop* --- ## [0.10.0](v0.9.0...v0.10.0) (2026-06-19) ### Added * add ClearLines to redraw realtime graph without flicker ([66346cb](66346cb)) * **cli:** clear only previous graph in realtime mode ([#79](#79)) ([3c935a3](3c935a3)) ### Fixed * **cli:** clear previous graph before plotting in realtime mode ([cbc1f4a](cbc1f4a)), closes [#44](#44) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Closed
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
Fixes #44 by clearing only the previous graph instead of wiping the whole terminal in realtime mode, removing flicker and preserving any output above the graph.
Changes
asciigraph.ClearLines(n)helper that erases the lastnlines (cursor up + clear to end of screen) without touching content above them.lastGraphLines) and callsClearLinesinstead of the full-screenClear().Verification
go test ./...(incl. newTestClearLines),go vet ./...,gofmt, andGOARCH=armcross-compile all pass.seq 1 100 | go run ./cmd/asciigraph -rredraws in place with no flicker; captured output contains zero full-screen\033[2Jwipes.Closes #44