Address issue #214: Fix copy-paste regression in editor#220
Merged
Conversation
The writeSelectionToPasteboard:types: override introduced in commit bd2e293 completely replaced NSTextView's implementation instead of extending it. This broke standard copy-paste because it only handled NSPasteboardTypeString and the markdown type, ignoring other types NSTextView normally handles. The fix calls super first to let NSTextView handle standard pasteboard operations (plain text, RTF, attributed strings, etc.), then adds our markdown type on top using addTypes:owner: which preserves existing data. Related to #214
Contributor
Code Coverage ReportCurrent Coverage: 42.58% Coverage Details (Summary) |
Owner
Author
|
Closes #214 |
Closed
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
MPEditorView.mwhere thewriteSelectionToPasteboard:types:method completely replaced NSTextView's implementation instead of extending itbd2e293(issue Use net.daringfireball.markdown UTType when copying to pasteboard #196: Add markdown UTType support)NSPasteboardTypeStringandkMPMarkdownPasteboardType, ignoring other types NSTextView normally handles (RTF, attributed strings, etc.)The fix: Call
superfirst to let NSTextView handle standard pasteboard operations, then add the markdown type on top usingaddTypes:owner:which preserves existing pasteboard data.Related Issue
Related to #214
Manual Testing Plan
Smoke Test (minimum)
**bold** *italic*, paste → syntax preservedRegression Comparison
bd2e293): Copy-paste failsMarkdown UTType Verification (issue #196)
Review Notes