feat(ansi): sequences: add iterator and reader for ANSI escape sequences#756
Open
aymanbagabas wants to merge 9 commits intomainfrom
Open
feat(ansi): sequences: add iterator and reader for ANSI escape sequences#756aymanbagabas wants to merge 9 commits intomainfrom
aymanbagabas wants to merge 9 commits intomainfrom
Conversation
This was referenced Jan 27, 2026
This adds a new package `sequences` that provides an iterator and a reader for ANSI escape sequences and grapheme clusters. The iterator allows for easy traversal of strings containing ANSI codes, while the reader integrates with `bufio.Scanner` for convenient scanning of input streams. Fixes: #215
83b2cc0 to
fba5a00
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #756 +/- ##
===========================================
+ Coverage 29.07% 52.27% +23.20%
===========================================
Files 182 57 -125
Lines 15867 3516 -12351
===========================================
- Hits 4613 1838 -2775
+ Misses 10965 1611 -9354
+ Partials 289 67 -222 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
caarlos0
approved these changes
Jan 27, 2026
…rt incomplete sequences
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.
This adds a new package
sequencesthat provides an iterator and a reader for ANSI escape sequences and grapheme clusters. The iterator allows for easy traversal of strings containing ANSI codes, while the reader integrates withbufio.Scannerfor convenient scanning of input streams.Fixes: #215
Here's an example parsing escape sequences from stdin that you can test with something like
printf 'abc 🛡️\x1b[1;2;3;4;;m \x1bP0q;abc\x1b\\' | go run ./parserlog3