Skip to content

Add in-preview find with match highlighting and navigation - #33

Merged
zhemingfan merged 1 commit into
mainfrom
feature/preview-find
Jul 4, 2026
Merged

Add in-preview find with match highlighting and navigation#33
zhemingfan merged 1 commit into
mainfrom
feature/preview-find

Conversation

@zhemingfan

Copy link
Copy Markdown
Owner

Summary

Upgrades preview search from a plain row filter to an editor-style find, shared across the 13 VirtualTable previews and the VCF preview. This is the biggest interactive-UX gap: VirtualTable only filtered, and VCF had no text find at all.

Stacked on #32 (base feature/inline-error-decorations) so the diff shows only the find changes. Retarget to main once #32 merges.

What's new

  • Ctrl/Cmd+F opens a find bar in the preview; Esc closes.
  • Highlight in place — every match is wrapped in <mark> across visible cells (the editor model), rather than filtering rows away.
  • NavigationEnter / Shift+Enter (and F3 / Shift+F3) cycle matches; the list scrolls to the active match and the row is emphasised. A "3 / 27" counter shows position.
  • Match case toggle and an optional filter-to-matches toggle (the old filter behaviour, one click away).

Design

  • One shared useTableFind hook owns query/options/active-match state and computes matching rows over the loaded set (debounced); a presentational FindBar and a highlightMatches helper are reused by both hosts. This mirrors the diagnostics-context pattern.
  • Matching is over loaded rows only; highlighting renders just for the virtualized visible cells; bounded by the existing 200K preview cap.
  • Previews that already ship a bespoke filter (GtfGff, mzTab) compose cleanly — their filter narrows the set, find highlights/jumps within it. Custom non-table previews (MGF, MAF alignment) keep their own search and are unchanged.

Testing

  • highlight.test.tsx — empty/no-match passthrough, case sensitivity, multiple occurrences.
  • useTableFind.test.tsx — debounced match counting, next/prev wrapping, filter-to-matches, zero-match state.
  • FindBar.test.tsx — open/closed render, position/"No results" label, button + Enter/Shift+Enter wiring, disabled nav.
  • Full suite: 75 webview tests and 802 unit tests pass; lint, all type-checks, and the build are green.

Follow-ups (not in this PR)

  • Migrate the bespoke per-preview filters (GtfGff, mzTab) onto the shared find to remove the double search box.
  • Regex / whole-word / replace.

Replaces VirtualTable's basic row filter with an editor-style find shared by the
table previews and the VCF preview. Ctrl/Cmd+F opens a find bar; matches are
highlighted in place with next/previous navigation (Enter / Shift+Enter / F3), a
match count, a case-sensitivity toggle, and an optional filter-to-matches mode.
Matching rows are scrolled into view and the active match row is emphasised.

Adds a shared useTableFind hook, a highlightMatches helper, and a presentational
FindBar, wired into VirtualTable (covering the table previews) and VcfPreview
(alongside its structured filter bar). Includes unit and component tests for the
highlighter, the hook (match counting, navigation wrapping, filter mode), and
the bar.
Base automatically changed from feature/inline-error-decorations to main July 4, 2026 01:44
@zhemingfan zhemingfan closed this Jul 4, 2026
@zhemingfan zhemingfan reopened this Jul 4, 2026
@zhemingfan
zhemingfan merged commit 7d09f56 into main Jul 4, 2026
3 checks passed
@zhemingfan
zhemingfan deleted the feature/preview-find branch July 4, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant