feat(analyze): incremental filter (/) for Top files and tree views#1107
Open
iuhoay wants to merge 1 commit into
Open
feat(analyze): incremental filter (/) for Top files and tree views#1107iuhoay wants to merge 1 commit into
iuhoay wants to merge 1 commit into
Conversation
Press / in the disk explorer to filter the current list as you type; Enter applies, Esc clears. Works in both the Top files (T) view and the directory drill-down view. Matching is case-insensitive substring over the entry name and display path. The full list is kept in largeFilesAll / entriesAll while largeFiles / entries hold the rendered view, so every existing reader (render, navigation, delete, open) stays unchanged. Changing the query clears multi-selection so an action can never touch a row hidden by the filter. Drilling into a filtered directory snapshots the parent in full and remaps the selection, so going back restores the unfiltered siblings with the entered directory still highlighted. Shared helpers (filterMatches, generic filterByQuery and removeByPath) back both views so their match semantics cannot drift. removePathFromView now trims the backing list once and rebuilds each view through the filters, fixing a corruption where deleting with no active filter shifted an aliased backing array twice and left a duplicated, stale entry.
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.
What
Adds an incremental, type-to-filter to the
analyzedisk explorer. Press/to filter the current list as you type,Enterto apply,Escto clear. Works in both:T) view, andMatching is case-insensitive substring over the entry name and its display path. This makes a deep scan navigable when you already know what you are looking for (e.g.
node_modules,.mp4), instead of only scrolling a size-ranked list.Usage
The footer and a
Filter: <query> (N matches)line show the active state.Implementation notes
largeFilesAll/entriesAll;largeFiles/entrieshold the rendered view. Every existing reader (render, navigation, delete, open) is unchanged because it already reads the view slice.filterMatches, genericfilterByQuery/removeByPath) so the two views cannot drift.Safety fix included
While wiring the shared
removeByPath, this also fixes a list-corruption bug: when no filter is active the view aliases its backing list, and removing from both shifted the shared array twice, leaving a duplicated, stale entry after a delete.removePathFromViewnow trims the backing list once and rebuilds each view through the filters.Testing
cmd/analyze/analyze_filter_test.go(Top-files + tree filters, drill-in round-trip, multi-select safety, backing-list integrity).go test ./cmd/...green,gofmtclean,go vetclean,make buildpasses.No new dependencies; matching is plain substring (fuzzy ranking left as a follow-up).