Skip to content

help -f : ANSI coloring in table data breaks string manipulation #14907

Open
@reverendpaco

Description

Describe the bug

The ANSI highlighting of the discovered term in help -f is carried through in the table cell, leading to that data not being usable as an un-highlighted string.

How to reproduce

 help -f which | get 0.name | help $in

returns

Error: nu::parser::not_found

  × Not found.
   ╭─[entry #235:1:36]
 1   help -f which | get 0.name | help $in
   ·                                    ─┬─
   ·                                     ╰── did not find anything under this name
   ╰────

The below works (after manually stripping termcodes)

 help -f which | get 0.name | ansi strip | help $in

Expected behavior

Should work like other built-ins like ls which, while having coloring, somehow return the un-highlighted string after a get (is this an issue with get? or is it that help -f is putting in qualitatively different data than ls?)

Image

Note how run-external from the ls built-in is un-highlighted after get.6.name while help -f followed by get returns the highlighted string.

Configuration

key value
version 0.101.0
major 0
minor 101
patch 0
branch
commit_hash fb26109
build_os macos-aarch64
build_target aarch64-apple-darwin
rust_version rustc 1.81.0 (eeb90cda1 2024-09-04)
rust_channel 1.81.0-aarch64-apple-darwin
cargo_version cargo 1.81.0 (2dbb1af80 2024-08-20)
build_time 2024-12-22 15:48:41 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, static-link-openssl, trash
installed_plugins

Metadata

Assignees

No one assigned

    Labels

    needs-triageAn issue that hasn't had any proper look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions