Skip to content

Fix ANSI-aware truncation in input list (#18310)#18340

Merged
fdncred merged 1 commit into
nushell:mainfrom
puneetdixit200:fix-fuzzy-ansi-truncation
Jun 4, 2026
Merged

Fix ANSI-aware truncation in input list (#18310)#18340
fdncred merged 1 commit into
nushell:mainfrom
puneetdixit200:fix-fuzzy-ansi-truncation

Conversation

@puneetdixit200

Copy link
Copy Markdown
Contributor

Description

Fixes #18310.

input list now measures rendered item width after stripping ANSI escape sequences before deciding whether to add an ellipsis. When truncation is needed, it cuts by the visible stripped prefix through ansi-str, so formatted options keep their styling without counting escape bytes as terminal columns.

User-facing changes (Release notes)

Fixed input list --fuzzy truncating ANSI-styled options too early because formatting escape sequences were counted as visible width.

Additional notes

Verification:

  • cargo test -p nu-command ansi_styled_text
  • cargo test -p nu-command platform::input::list::test
  • toolkit fmt
  • toolkit clippy
  • git diff --check
  • toolkit test stdlib

A full toolkit check pr run completed fmt, all clippy phases, and the main test suites through nu-command, including the new tests. It then failed in unchanged nu-lsp completion tests with receive timeouts at crates/nu-lsp/src/lib.rs:583 (case_12_use_module, case_13_use_null_device, case_14_use_foo, and case_15_use_submodule). The failing nu-lsp cases pass when rerun individually or outside the full parallel run.

@fdncred fdncred merged commit 6905412 into nushell:main Jun 4, 2026
19 checks passed
@fdncred

fdncred commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Thanks

@github-actions github-actions Bot added this to the v0.114.0 milestone Jun 4, 2026
nidara-duo pushed a commit to nidara-duo/nushell that referenced this pull request Jun 5, 2026
)

## Description

Fixes nushell#18310.

`input list` now measures rendered item width after stripping ANSI
escape sequences before deciding whether to add an ellipsis. When
truncation is needed, it cuts by the visible stripped prefix through
`ansi-str`, so formatted options keep their styling without counting
escape bytes as terminal columns.

## User-facing changes (Release notes)

Fixed `input list --fuzzy` truncating ANSI-styled options too early
because formatting escape sequences were counted as visible width.

## Additional notes

Verification:
- `cargo test -p nu-command ansi_styled_text`
- `cargo test -p nu-command platform::input::list::test`
- `toolkit fmt`
- `toolkit clippy`
- `git diff --check`
- `toolkit test stdlib`

A full `toolkit check pr` run completed `fmt`, all clippy phases, and
the main test suites through `nu-command`, including the new tests. It
then failed in unchanged `nu-lsp` completion tests with receive timeouts
at `crates/nu-lsp/src/lib.rs:583` (`case_12_use_module`,
`case_13_use_null_device`, `case_14_use_foo`, and
`case_15_use_submodule`). The failing `nu-lsp` cases pass when rerun
individually or outside the full parallel run.

Co-authored-by: Deepak kudi <deepakkudi23@adsl-172-10-9-116.dsl.sndg02.sbcglobal.net>
@fdncred fdncred added notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes labels Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

input list --fuzzy treats ansi formatting characters as if they have visible length

2 participants