Type-to-filter in file panels
Typing while the list is focused builds a filter query: a bar appears under the column headers (search icon, query, live match count, Esc hint, clear button) and the listing narrows to substring matches — '..' always stays. Backspace edits the query, Escape clears it, cursor parks on the first match, arrows/Enter keep working (the list never loses focus), and Space keeps its select meaning until a query exists. Filter resets on directory change and survives refresh; operations act only on visible (filtered) selection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -186,6 +186,24 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- type-to-filter bar (appears while a query is active) -->
|
||||
@if (panel().filter(); as query) {
|
||||
<div class="flex items-center gap-1.5 border-b border-border bg-accent/50 px-2 py-1">
|
||||
<ng-icon name="mynaSearch" size="0.85rem" class="shrink-0 text-muted-foreground" />
|
||||
<span class="min-w-0 flex-1 truncate font-mono text-xs">{{ query }}</span>
|
||||
<span class="shrink-0 text-[11px] text-muted-foreground">
|
||||
{{ filterMatches() }} match{{ filterMatches() === 1 ? '' : 'es' }} · Esc
|
||||
</span>
|
||||
<button
|
||||
(click)="clearFilter()"
|
||||
title="Clear filter (Esc)"
|
||||
class="grid size-5 shrink-0 place-items-center rounded text-muted-foreground hover:bg-accent hover:text-foreground"
|
||||
>
|
||||
<ng-icon name="mynaX" size="0.8rem" />
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- file list -->
|
||||
<div
|
||||
#list
|
||||
@@ -224,4 +242,7 @@
|
||||
} @empty {
|
||||
<div class="p-6 text-center text-xs text-muted-foreground">Empty directory</div>
|
||||
}
|
||||
@if (panel().filter() && filterMatches() === 0) {
|
||||
<div class="p-6 text-center text-xs text-muted-foreground">No matches</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user