Fix tab characters causing unexpected line breaks near line end#256
Merged
Fix tab characters causing unexpected line breaks near line end#256
Conversation
Configure explicit tab stops in NSParagraphStyle to match 4-space tab width. This fixes the issue where NSLayoutManager's default tab stop calculation caused premature line wrapping when a tab character was added near the end of a line, even when visual space remained. The fix: - Calculates tab interval based on the editor font's space character width - Creates 100 tab stops at regular intervals (sufficient for wide documents) - Automatically recalculates when font changes Related to #195
Contributor
Code Coverage ReportCurrent Coverage: 51.51% Coverage Details (Summary) |
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
Configure explicit tab stops in
NSParagraphStyleto fix unexpected line breaks when tab characters are added near the editor's line boundary.Root Cause: The editor used vanilla
NSTextViewwithout explicit tab stop configuration.NSLayoutManagercalculates tab width based on default tab stop positions (not remaining visual space), causing premature line wrapping when a tab was added near the end of a line.Fix: Set tab stops at regular intervals based on the editor font's space width × 4, matching the existing 4-space tab convention used throughout the codebase.
Related Issue
Related to #195
Changes
setupEditor:methodManual Testing Plan
Setup
Primary Test Scenario
Additional Test Scenarios
Edge Cases
Verification Checklist
Review Notes
setupEditor:method