-
Notifications
You must be signed in to change notification settings - Fork 121
Add utility function ansi::slice_ansi_str
#206
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
base: main
Are you sure you want to change the base?
Conversation
3811bcc
to
3324138
Compare
0f33b85
to
ce77cc5
Compare
ansi::slice_ansi_str
ansi::slice_ansi_str
Can you avoid |
Indeed, that should be good now 👍 |
And format is also a recent-is feature, on it 😬 I'll try to build on 1.56, it didn't work last time I tried it because it fails to resolve EDIT : Ok, got it |
Should be good, |
97b3716
to
66bb444
Compare
Hi! I bumped into this while doing some cleanup and I think it might still be useful. So I've rebased it on latest main! |
I definitely don't want to accept a semver-incompatible change for this. Is there a way to make this compatible? |
Hi! You're right that it would be a shame. Although I think I made a mistake with semver : I only added a new function without affecting the behavior of the existing, as we're still on unstable scheme 0.x.y this should only affect the last (y) component. I changed the target version to 0.15.12 and made sure that I didn't modify previously existing test cases 👍 |
Okay, this doesn't currently pass the MSRV jobs in CI, so that's something that will have to be fixed. I'd like a cleaner set of changes for review, with separate commits or PRs for each of these changes:
Please avoid unrelated changes as much as possible (as such, keep functions/logic in the place as much as possible to minimize the diffs). You can leave the version bumping and changelog to me (note that the |
3740c3f
to
1599bf9
Compare
Hello mon ami ! 🥖 Those are super relevant comments 👍
|
d662074
to
c0e5ff2
Compare
I'm putting this in draft until #250 is solved. |
Rebased & ready for review again! 😄 |
let mut slice_start = 0; // Current search index by bytes | ||
|
||
// Extract the leading slice, which *may be mutated* to remove just its first character. | ||
'search_slice_start: while pos < bounds.start { |
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.
I'm counting 5 loops here, two of which are nested. Fundamentally, why is that necessary? It seems like there is more complexity here than is warranted.
(Also needs a rebase.) |
Hi!
While working on a bug of
indicatif
(cf. console-rs/indicatif#627), I needed an ANSI-aware slicing method. I think it made more sense to add it in this crate.This is a generalisation of
truncate_str
😃