Repository navigation
Conversation
A soft line break is stored as "\n" inside a paragraph's text but renders as a space, so a query such as "a chat assis" never matched text that wrapped onto the next source line. Outside code blocks the aggregated text now reads each soft break as a space before matching. The swap is one character for one, so match offsets still map onto document positions for decorations and replace. Code blocks keep "\n", where it is a real line break. Regression tests cover literal, whole-word and regex queries, a break inside marked text, replace consuming the break, code blocks, hard breaks, and a document parsed through the real markdown pipeline. Closes #1590
10 of 17 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In WYSIWYG mode, Find could not match text across a soft line break: the break is stored as
"\n"inside the paragraph's text, but it renders as a space, so a query such asa chat assisfound nothing. Outside code blocks, the text being searched now reads each soft break as a space. The swap is one character for one, so match positions stay exact for highlighting, navigation, Replace and Replace All.Policy Gates (Required)
Linked Issue
Type of Change
What Changed
src/plugins/search/findMatches.ts: soft breaks are treated as spaces in prose before matching; code blocks (spec.code) keep"\n". The header's key decisions are updated.src/plugins/search/findMatches.test.ts: 7 regression tests — literal, whole-word and regex queries; a break inside bold text; Replace consuming the break; code-block newlines unaffected; hard breaks still not matching; a document parsed through the real markdown pipeline with the StarterKit schema (fails without the fix, passes with it).\nno longer matches a soft break in prose (it reads as a space, as the user sees it);\sand a literal space both match it. Source mode is unchanged: there the newline is a visible line break.Validation
pnpm check:alllocally.UI Evidence (if applicable)
Not applicable — no visible UI change.
PR Checklist