Skip to content

input list doesn't support ANSI colored strings well #16200

@MarvinJWendt

Description

@MarvinJWendt

Describe the bug

Hi, I am not sure if this is really a bug, or should be labeled as a feature request.
Feel free to change :)

Using input list with ANSI colored strings results in incorrectly colored items.
The reason for that is, that there is no ANSI reset sequence at the end of items.

Why this matters?

When building a list dynamically from user defined data, the user might include ANSI codes, which will mess up the formatting.
Many people may not consider this when building scripts that load raw data.

Tables / lists handle ANSI correctly (since the border color overwrites the color before):

Image

input list does not:

Image

When selecting a different item, everything gets colored:

Image

As a workaround, a manual ANSI reset sequence can be put at the end of the item:

Image

How to reproduce

["this" "is" "a" $"(ansi red)colored" "list"] | input list

Expected behavior

I expected nu to correctly escape the item coloring.

Configuration

key value
version 0.105.1
major 0
minor 105
patch 1
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.88.0 (6b00bc388 2025-06-23) (built from a source tarball)
cargo_version cargo 1.88.0 (873a06493 2025-05-10)
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator standard
features default, sqlite, trash
installed_plugins gstat 0.105.1, polars 0.105.1, query 0.105.1

Metadata

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