-
Notifications
You must be signed in to change notification settings - Fork 33
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
handle ansi style in cell content #93
Conversation
@Nukesor could you approve the CI workflow? |
Codecov Report
@@ Coverage Diff @@
## main #93 +/- ##
==========================================
- Coverage 96.05% 96.02% -0.04%
==========================================
Files 17 17
Lines 1547 1610 +63
==========================================
+ Hits 1486 1546 +60
- Misses 61 64 +3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@blueforesticarus You can also test the CI on your fork by enabling Actions over there :) |
@Nukesor What do you want the logic to be when the tty feature is not enabled? Edit: I just hard coded the constant so I wouldn't need cross-term. That fixes tests and linter problems. |
No need to setup codecov :) Regarding the Otherwise, I don't see a big problem with including it in the default feature set. Did you try the |
Looks like console has a few unsafe blocks, but its all in term support and nothing I am using touches it. |
|
@Nukesor let me know if that bench result is acceptable or if you want to make a feature flag. |
Sorry for being so slow to respond 😓 I'm currently in the middle of a job transition and really don't have a lot of time to work on my open source projects. |
A ~22% performance regression for a feature that isn't being used by many users isn't that nice. I would definitely opt to hide this behind a feature flag! In general, this doesn't look too bad, but it definitely needs a lot of tests :D |
last_txt = head.len(); | ||
escape_count = escapes.len(); | ||
} | ||
} else { |
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.
Early continue
for better readability
let mut head = String::with_capacity(word.len()); | ||
let mut last_txt = 0; | ||
let mut escape_count = 0; | ||
let mut tail = String::with_capacity(word.len()); |
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.
Please write proper inline documentation on what this algorithm does.
It's by no means trivial and quite hard to read/understand right now when one is not familiar with how Ansi escape sequences work.
Try to chunk the algorithm into logical blocks and explain what each block is doing in a sentence or two.
Also, please write docs on what these variables are for.
@Nukesor I think I addressed everything |
Nice :) I'll review it as soon as I find some time to do so! |
First of all, thanks for your work and time! I'm going to merge this soon, but there were still some open issues I wanted to address first. Feel free to check out my additions over here: |
intends to supersede #77
would close #91