`StripStr` doesn't appear to maintain state across calls to `strip_next`.

Open
#339 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
cli

Research direction

Start at anstream's StripStr::strip_next entry point and reproduce the two-call sequence with "\x1b[" followed by "38;", consuming each iterator. Compare its state and output with StripBytes; done means StripStr preserves the incomplete escape state and strips the continuation consistently, with coverage for this sequence.

Written by the indexing model from the issue text.

Description

A-stream

When I pass "\x1b[" to anstream's StripStr::strip_next (and consume the iterator) , then call it again with "38;", the "38;" is not stripped as I would expect but is returned from the iterator. Printing out the StripStr shows that it is in the Ground state after the first call.

When I use StripBytes instead, the "38;" is stripped as I expected.

Dominant language
HTML
Stars
171
Forks
44
Avg merge
2h 34m
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-cli/anstyle

All issues in rust-cli/anstyle

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.