From ba5a72a42fc45d3f5726a14ef12e5e0f52786ee7 Mon Sep 17 00:00:00 2001 From: Galen Wright-Watson Date: Tue, 4 Dec 2018 17:19:39 -0800 Subject: [PATCH] Fix: copied text contains non-breaking spaces. Cause: `php -s` replaces spaces and tabs with non-breaking spaces. Soln: when copying text, replace non-breaking spaces in the plain text clipboard object with spaces. --- Source/BSSourceViewTextView.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Source/BSSourceViewTextView.m b/Source/BSSourceViewTextView.m index 9a7370e..fe4fa46 100644 --- a/Source/BSSourceViewTextView.m +++ b/Source/BSSourceViewTextView.m @@ -22,6 +22,19 @@ @implementation BSSourceViewTextView @synthesize sourceView = sourceView_; +- (void)copy:(id)sender { + [super copy:sender]; + //NSStringPboardType + NSString *text = [[NSPasteboard generalPasteboard] stringForType:NSPasteboardTypeString]; + if (text) { + [[NSPasteboard generalPasteboard] + setString:[text + stringByReplacingOccurrencesOfString:@"\u00A0" + withString:@" "] + forType:NSPasteboardTypeString]; + } +} + - (void)drawRect:(NSRect)rect { [super drawRect:rect]; -- 2.11.0 (Apple Git-81)+GitX