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

Fix some issues regarding ANSI CSI handling #1611

Merged
merged 5 commits into from
Apr 12, 2023
Merged

Conversation

guludo
Copy link
Contributor

@guludo guludo commented Apr 6, 2023

When replying to an email containing ANSI CSI escapes, those sequences are currently included in the reply's quoted message. This PR makes sure they are removed. While working on it, I realized some other issues in the generation of urwid attributes and added fixes for those as well.

Otherwise, some attributes set from ECODES will be kept in the dict.
That is a valid way of resetting and must be properly regognized.
Do that so we get the correct order of operations: as the comment says,
append_themed_infix(infix) must use the previous (a.k.a. current)
attr dict.
@guludo guludo force-pushed the nx/fix-ansi branch 2 times, most recently from 6efa797 to 2d34256 Compare April 6, 2023 12:38
@guludo
Copy link
Contributor Author

guludo commented Apr 6, 2023

Force-pushed to fix style.

Extract existing logic to get ANSI CSIs into a dedicated module. While
at it, also implement a function to filter out those escape sequences.
That function will be used in a future commit to clean up the message
text when generating the quoted text for the a reply.
It is undesirable to have those sequence in the quoted text of a reply
message. Remove them.
@guludo
Copy link
Contributor Author

guludo commented Apr 6, 2023

Went through existing issues and realized that this fixes #1531.

Copy link
Owner

@pazz pazz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! I always wondered where these extra codes came from but never properly investigated. Thanks for the very clean code and commit messages. I agree with all changes made here!

@pazz pazz merged commit 6f3c3f0 into pazz:master Apr 12, 2023
@guludo guludo deleted the nx/fix-ansi branch April 12, 2023 19:20
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