Skip to content

fix(fold): parse numeric width from current index in clustered short options - #1896

Merged
caomengxuan666 merged 1 commit into
unixwin:mainfrom
dingyi580:fix/fold-clustered-numeric-width
Nov 27, 2026
Merged

caomengxuan666 merged 1 commit into
unixwin:mainfrom
dingyi580:fix/fold-clustered-numeric-width

Conversation

@dingyi580

Copy link
Copy Markdown

Summary

  • Slice clustered short-option numeric widths in fold.rs starting from the current digit offset chars[ci..] rather than &arg[1..], matching GNU coreutils 9.4 src/fold.c:267-278 (optarg--).
  • Previously, clustered flags such as fold -s4 or fold -b3 passed "s4" / "b3" to parse_width and failed with fold: invalid number of columns: 's4'.
  • No user-visible I18N catalog strings (tr!) are modified.

What was removed

  • Removed let original = &arg[1..]; whole-cluster slicing on digit short options.

Verification

  • rustfmt --check --edition 2021 rust2/crates/winux-cmds/src/fold.rs: passed
  • cargo check --workspace --tests --target x86_64-pc-windows-msvc & aarch64-pc-windows-msvc: passed
  • Windows cargo test execution (clustered_flag_and_digit_short_options): owed to PR CI

@caomengxuan666

Copy link
Copy Markdown
Member

CAPTAIN-VERIFY(X299 运行时复验):达合入门,队长合入。lib 1092/0、新钉实跑绿;driver 六形(-s4/-b3/-s4x/-42/-w4/-w 4)与 GNU coreutils 9.4 逐项全合(-s4x 仅 argv0 前缀差)。

@caomengxuan666
caomengxuan666 merged commit a180fa6 into unixwin:main Nov 27, 2026
32 checks passed
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