Skip to content

input list: improve streaming stability/perf + rendering - #18462

Merged
fdncred merged 4 commits into
nushell:mainfrom
jlcrochet:input-list-streaming
Jun 26, 2026
Merged

fdncred merged 4 commits into
nushell:mainfrom
jlcrochet:input-list-streaming

Conversation

@jlcrochet

@jlcrochet jlcrochet commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

This improves loading items from stream inputs so that streaming is faster, more responsive, and doesn't block the UI. Some minor improvements were also made to handling of control characters so that they don't mess up rendering as much, hopefully.

On startup, if the input is a stream, input list waits up to 250ms for the input to collect before rendering the UI; if the stream hasn't finished collecting by the first paint, it will display a live-updating count in the footer as the items stream in. Pressing End to jump to the final list of the item will pin the cursor at the end so that it will stay there as new items stream in; the cursor will stay pinned until no items remain or until the user moves the cursor manually.

Additionally, I fixed a rendering bug where the header rows in table mode would not properly redraw if columns in the rest of the table expanded during scrolling.

User-facing changes (Release notes)

Improved input list streaming and rendering

  • input list no longer blocks first paint until stream inputs are fully collected; now, it shows a live-updating count of currently collected items in the footer and allows the UI to be responsive as items stream in.
  • In table mode, header cells now properly expand as their respective columns expand when scrolling through the list.
  • Fixed an issue where certain control characters like tabs could throw off UI alignment during rendering.

Additional notes

Related: #17963

@jlcrochet

Copy link
Copy Markdown
Contributor Author

I'd like to clean up the code a bit to make it easier to maintain in a follow-up PR.

truncated: bool,
}

fn skip_ansi_escape<I>(chars: &mut std::iter::Peekable<I>)

@fdncred fdncred Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have a couple functions in utils that trip ansi. no need to write another, right? or perhaps there is some other purpose?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I added a helper instead of using the existing utils is because input list has some specific requirements:

  • it needs to expand tabs in order to determine line/column width
  • it needs other control characters to either be dropped or considered zero-width for alignment purposes
  • it needs to preserve ANSI sequences when rendering so that the user's color scheme looks right for data types
  • it needs to preserve character indices for fuzzy highlighting
  • it doesn't need to allocate a new, stripped string, which I think is what a lot of the existing helpers do

Basically, I added the helper just to avoid having to work around the limitations of the existing utils. Maybe it would have been better to use utils anyway just to have less code, though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let's see what copilot thinks.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the input list interactive UI to behave better with streaming inputs by avoiding full upfront collection, keeping the UI responsive while items arrive, and improving table/header rendering correctness as streamed rows change column widths. It also adds more robust handling of control characters (notably tabs) so rendering/truncation is based on terminal width semantics rather than raw byte/char counts.

Changes:

  • Introduces a background stream reader + periodic polling to incrementally append streamed rows without blocking initial UI rendering.
  • Improves rendering/truncation by sanitizing control characters and measuring terminal width with tab-stop awareness; adds a footer spinner/count while streaming.
  • Tracks table layout growth from streamed rows and forces header redraws when column widths change; adds focused unit tests for the new behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jlcrochet

Copy link
Copy Markdown
Contributor Author

Good suggestions from Copilot.

In further testing, I'm noticing that fuzzy searching is a lot slower than I'd like. I tried streaming about 500k lines into input list --fuzzy and tried doing a search: the live-streaming finished almost instantly, but the search took several seconds to render after each keypress.

I think that the way I'm doing fuzzy searching here could be more efficient, but I'll probably save fuzzy search perf improvements for a follow-up PR. I wonder if we could use nucleo-matcher instead of SkimMatcherV2 for this.

@fdncred

fdncred commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

ya, i'd definitely use nucleo-matcher. we already depend on it. i'll make this draft until we find a better way forward.

@fdncred
fdncred marked this pull request as draft June 26, 2026 00:27
@jlcrochet

Copy link
Copy Markdown
Contributor Author

Okay, I swapped out SkimMatcherV2 with NucleoMatcher. In my 500k line test case from before, searching performance doesn't seem noticeably better, but at this point I think that test is probably unrealistic for everyday use. If nothing else, this change eliminates the dependency on fuzzy-matcher entirely since it was only being referenced by input list anyway.

@jlcrochet
jlcrochet marked this pull request as ready for review June 26, 2026 07:32
@fdncred
fdncred merged commit 304400d into nushell:main Jun 26, 2026
19 checks passed
@fdncred

fdncred commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

ok, let's try it. thanks!

@github-actions github-actions Bot added this to the v0.114.0 milestone Jun 26, 2026
@fdncred fdncred added notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes labels Jun 26, 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.

3 participants