-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to skip ansi escape codes #103
Conversation
3847d78
to
1c1cd35
Compare
Adding an optional Options or Config generated by a ConfigBuilder would be ideal, so that we don't have to change the API for every field. I would also add a |
eca1f4a
to
b0b521b
Compare
Thanks for the quick review @petreeftime. I've added Options, which makes the diff much more readable. The |
b0b521b
to
b0cdd41
Compare
Yeah that CI failure is attempted to be fixed in #101 - it is some kind of sporadic failure which we did not find yet. |
Ah, thanks for the explanation! So I'll just leave this PR-as is, as bors should re-run the checks before an eventual merge anyways, right? LMK if there's something left to improve or fix :) |
Yeah I think this is fine... we'll ping you if there's anything to fix up, I guess. |
883b178
to
b1b6044
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, nice work!
@matthiasbeyer Friendly ping :) could we merge this? |
Yes we could, but we're getting the sporadic CI error again and for whatever reason I cannot re-run the CI. Could you @phaer please rebase this PR to latest master, or, if it is based on latest master: |
This CI failure is really annoying 😠 |
ansi escape codes are just the byte 27 inserted in a string, followed by "[", zero or more numbers separated by ";" and ending with a letter. We optionally just skip those in our non-blocking reader in order to efficently ignore them during matching. Signed-off-by: phaer <[email protected]>
Signed-off-by: phaer <[email protected]>
Signed-off-by: phaer <[email protected]>
because handling of Err(_) and Ok(0) might be tricky otherwise, so we just use a boolean flag Signed-off-by: phaer <[email protected]>
f099dc4
to
e992f99
Compare
@matthiasbeyer Just remembered this, rebased and we've got a passing CI now 🥳 |
bors merge=souze |
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
This allows users to ignore ansi escape codes, such as terminal colors and would therefore close #25.
As you've noticed, i needed to add the new parameter
skip_ansi_escape_codes
in quite a few places. Maybe it would be a good idea to introduce anOptions
struct fortimeout
andskip_ansi_escape_codes
, with default values? I could do that, but wanted to keep this PR focused.I've considered using strip_ansi_escapes, mentioned in the issue. But that uses VTE which uses a state machine to interpret the escape codes.
But as we are not interested in interpreting them, just skipping them and ansi escape codes are just the byte 27 inserted in a string, followed by "[", zero or more numbers separated by ";" and ending with a letter;
We optionally just skip those in our non-blocking reader in order to efficently ignore them during matching without having to traverse the whole buffer a second time. A minimal test case is also added