Fix ANSI-aware truncation in input list (#18310)#18340
Merged
Merged
Conversation
Contributor
|
Thanks |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #18310.
input listnow 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 throughansi-str, so formatted options keep their styling without counting escape bytes as terminal columns.User-facing changes (Release notes)
Fixed
input list --fuzzytruncating ANSI-styled options too early because formatting escape sequences were counted as visible width.Additional notes
Verification:
cargo test -p nu-command ansi_styled_textcargo test -p nu-command platform::input::list::testtoolkit fmttoolkit clippygit diff --checktoolkit test stdlibA full
toolkit check prrun completedfmt, all clippy phases, and the main test suites throughnu-command, including the new tests. It then failed in unchangednu-lspcompletion tests with receive timeouts atcrates/nu-lsp/src/lib.rs:583(case_12_use_module,case_13_use_null_device,case_14_use_foo, andcase_15_use_submodule). The failingnu-lspcases pass when rerun individually or outside the full parallel run.