Repository navigation
input list: improve streaming stability/perf + rendering - #18462
Conversation
|
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>) |
There was a problem hiding this comment.
we already have a couple functions in utils that trip ansi. no need to write another, right? or perhaps there is some other purpose?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
ok, let's see what copilot thinks.
There was a problem hiding this comment.
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.
|
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 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. |
|
ya, i'd definitely use nucleo-matcher. we already depend on it. i'll make this draft until we find a better way forward. |
|
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 |
|
ok, let's try it. thanks! |
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 listwaits 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 liststreaming and renderinginput listno 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.Additional notes
Related: #17963