Fix layout shift when found text contains newlines in Find/Replace#11586
Merged
niksedk merged 1 commit intoJun 13, 2026
Merged
Conversation
When searching with a regex containing \n, the matched text could contain a literal newline. Embedding it in the "Found..." status message caused the status bar TextBlock to render as two lines, expanding the footer and shifting all main window components upward. Replace \r\n and \n with a middle dot (·) in found text before display. Also applied consistently to OCR All Fixes and Split/Break Long Lines previews, which previously used ↵ (not present in SF Pro, Helvetica etc.).
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.
Problem
When searching with a regex pattern containing
\n(e.g.\]\n), the matched text can include a literal newline character. This newline was embedded directly into the "Found '…' in line X, position Y" status message and displayed in a plainTextBlockin the main window footer. The TextBlock rendered the newline as a second line, doubling the footer height and causing all main window components (subtitle grid, toolbar, waveform) to shift upward. The shift reversed when the status message faded out after 3 seconds.status.string.mov
Fix
Replace
\r\nand\nwith a middle dot (·, U+00B7) in the matched text before embedding it in the status message. The middle dot is in the Latin-1 block and is present in every font a user might select.The same replacement is applied consistently in the OCR All Fixes list (
ReplacementUsedItem,GuessUsedItem) and the Split/Break Long Lines preview (SplitBreakLongLinesViewModel), which previously used↵(U+21B5). That character is absent from several popular fonts (including the macOS default system font), causing it to render as a box when the user had switched away from Avalonia's default Inter font.Files changed
src/ui/Features/Main/MainViewModel.cs— sanitizefoundTextat all fourFoundXInLineYZcall sites (Find, FindNext, FindPrevious, HandleReplaceResult)src/ui/Features/Ocr/FixEngine/ReplacementUsedItem.cssrc/ui/Features/Ocr/FixEngine/GuessUsedItem.cssrc/ui/Features/Tools/SplitBreakLongLines/SplitBreakLongLinesViewModel.cs