mirror of
https://github.com/stablyai/orca.git
synced 2026-09-29 08:03:20 +00:00
Add clarifying comments to palette ranking retention logic
- Document why capPaletteSection retains the selected match - Explain retainedResultId's role in keeping keyboard selection visible - Clarify secondaryMatches exposes additional match offsets
This commit is contained in:
@@ -35,6 +35,7 @@ export function capPaletteSection<T>(
|
||||
return { visible: items, overflowCount: 0 }
|
||||
}
|
||||
const visible = items.slice(0, cap)
|
||||
// Keep the selected match visible after reranking without increasing the DOM row cap.
|
||||
let retained: T | undefined
|
||||
if (retain) {
|
||||
for (let index = cap; index < items.length; index += 1) {
|
||||
|
||||
@@ -22,6 +22,7 @@ export type UseOpenTabSearchOptions = {
|
||||
enabled: boolean
|
||||
query: string
|
||||
worktreeId: string
|
||||
/** Keyboard-selected result's `id`; keep it inside the display cap while it still matches. */
|
||||
retainedResultId?: string | null
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ export type BrowserPaletteSearchResult = {
|
||||
/** Raw page URL, so callers can dedupe a row against another list of destinations. */
|
||||
url: string
|
||||
secondaryText: string
|
||||
/** Matched formatted/raw URLs with highlight offsets into each `text`; exposes hits beyond the displayed URL. */
|
||||
secondaryMatches: readonly { text: string; ranges: readonly MatchRange[] }[]
|
||||
workspaceLabel: string | null
|
||||
repoName: string
|
||||
|
||||
Reference in New Issue
Block a user