Skip to content
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

utils.astring: A couple of strip_console_codes fixes #135

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ldoktor
Copy link
Contributor

@ldoktor ldoktor commented Aug 19, 2024

I noticed the strip_console_code works quite oddly, let's add a selftest and fix the biggest issues.

Anyway the behaviour was here for a long time so this is here just to begin some discussion.

do not merge before a proper discussion!

we already set the "index += len(tmp_word) + 1" before we get to this
exception so we must not add the tmp_index.

Signed-off-by: Lukáš Doktor <[email protected]>
previously we only checked the console_code is found anywhere in the
text between the two \x1b and then we blindly removed first N
characters. Let's ensure we check the console code regexp from the
beginning.

Signed-off-by: Lukáš Doktor <[email protected]>
@smitterl
Copy link

Though I might be misunderstanding but matching only the start of a line doesn't seem to work, ref. #134 (comment)

these are sometimes generated by kernel, ignore them.

Signed-off-by: Lukáš Doktor <[email protected]>
Signed-off-by: Sebastian Mitterle <[email protected]>
@ldoktor
Copy link
Contributor Author

ldoktor commented Sep 9, 2024

@smitterl I have added a commit that should address the #134, could you please take a look on whether it behaves correctly and if not how to modify the selftest to cover your scenario? Then you can port it to your PR to get things rolling and later hopefully refine this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants