Skip to content

Find text in the open pad #250

Description

@HMarzban

Parent

#249 Deepen the installed PWA. Sibling of #247, #248, and #251. Not blocked by them.

What to build

Add caret find on the open pad. The user types a query, sees hits, and steps the caret to the next or previous hit.

Filter stays Filter. It hides Sections. It is not find. Rename the Filter field so it no longer says “Find in document”.

Acceptance criteria

  • Desktop and phone: a Find control opens a find bar on the pad. It does not open Filter.
  • That control sits next to Filter (same desktop toolbar, same phone host). Do not add a new 32 by 32 docked control.
  • Desktop: Mod-f opens that bar and does not open the browser find dialog.
  • Escape closes the bar and restores the fold snapshot taken when the bar opened.
  • Enter moves to the next hit. Shift-Enter moves to the previous hit. The caret lands in the current hit.
  • The query is a case-insensitive literal. Empty query clears hits. No regex. No replace.
  • Search walks the pad document, including Title. It does not search Pad title, chat, or History.
  • A viewer under Read-only or Editing lock can still find. History view has no find bar.
  • The current hit is visible. Unfold its Section. Keep every other fold from the open snapshot.
  • Hit paint uses a new decoration class. It does not write the Highlight mark. It does not reuse the Filter wash.
  • A polite live region outside the editor speaks the current index and the hit count, for example 3 of 12.
  • More than 200 hits: paint at most 200, show 200+, and step only those 200.
  • Find does not change the URL. It does not write filter path segments.
  • Filter field aria-label and placeholder no longer say “Find in document”. The panel title stays Filter.
  • Light and dark, desktop and phone: the bar is a compact pad control, not a BottomSheet.

Agent Brief

Category: enhancement
Summary: Real find on the pad, plus an honest Filter label.

Current behavior:
The Filter panel title is Filter. Its field still says “Find in document”. Apply hides unmatched Sections. It does not step hits or move the caret.

Folded Section bodies use display: none. Browser find cannot see them. The pad does not bind Mod-f.

matchSections skips Title and the nodes under Title. It is a Section index for Filter. It is not the hit engine.

A viewer can already run Filter. History unmounts the pad editor.

Desired behavior:
Open a find bar from a toolbar control next to Filter. On desktop, Mod-f opens the same bar and steals browser find. That steal is required, because folded text is hidden from the page.

Walk the live pad document. Include Title. Ignore Pad title, the chat composer, and History.

Treat the query as a trimmed, case-insensitive substring. Do not add whole-word, regex, or replace.

When the bar opens, snapshot the current folds. For the current hit, unfold that Section only. Leave the rest of the snapshot in place. Do not replace the whole fold set with one id. Closing the bar restores the snapshot. Filter can stay on.

Paint hits with a new inline decoration class. Do not write the stored Highlight mark. Do not reuse the Filter highlight class. Do not put a live region inside the editor.

Cap paint and stepping at 200 hits. If there are more, show 200+.

A Read-only viewer can find. An Editing lock still allows find. Do not run find when History has unmounted the pad.

#175 is theme flip and a two-key help dialog. Do not add find to that help table.

Key interfaces:

  • Caret find — bar, next, previous, caret on the current hit
  • Filter — Section hide only; field no longer claims find
  • Title — first heading; included in search
  • Pad title — header name; not searched
  • Section — heading plus following nodes; unfold the one that holds the current hit
  • Editing lock — blocks edits; does not block find
  • Highlight — stored mark; do not use it to paint hits

Out of scope

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions