Markpad icon indicating copy to clipboard operation
Markpad copied to clipboard

Find in the preview misses text that crosses formatting or a line break

Open PathGao opened this issue 1 month ago • 0 comments

Markpad version

2.8.4 (master at 7743e78)

How did you install it?

Built from source

OS and version

macOS 27. The cause is in the frontend, so all platforms.

What happens, and what you expected instead

Find (Ctrl/Cmd+F) in the preview only matches inside a single text node. FindBar.svelte walks text nodes one at a time and searches each on its own, so a phrase that crosses any element boundary is not found, even though it reads as one run of text on screen:

  • bold **text**: searching bold text finds nothing, because <strong> splits it.
  • A newline inside a paragraph: searching across it finds nothing. With hard breaks the two words are on separate lines, so few people try. With #970's Every Newline Breaks the Line off, they sit on one line, so it looks like a miss.

Expected: match the text as rendered, the way the browser's own find does. On a GitHub README, native find matches a phrase across a soft break.

Steps to reproduce

  1. Open a file containing one **two** three.
  2. In the preview, press Ctrl/Cmd+F and search one two.
  3. No match.

The Markdown that triggers it

one **two** three

one
two

Screenshots, and anything else

A fix probably means building the searchable text across a block's text nodes (whitespace collapsed to one space) and mapping matches back to ranges, then highlighting through those ranges. That reaches every document, so it is kept out of #970.

PathGao avatar Oct 20 '26 09:10 PathGao