aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMTextView.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-04-03 08:57:28 +0000
committerBibiko <bibiko@eva.mpg.de>2009-04-03 08:57:28 +0000
commit4e687203f03dda7b0af9aa0433b80231e14baffb (patch)
tree531627a8ce96b88a740c9c2301f59b648f9a5003 /Source/CMTextView.m
parentbdf4a64d1b0b337c7dfe9af89debd9f6024d599a (diff)
downloadsequelpro-4e687203f03dda7b0af9aa0433b80231e14baffb.tar.gz
sequelpro-4e687203f03dda7b0af9aa0433b80231e14baffb.tar.bz2
sequelpro-4e687203f03dda7b0af9aa0433b80231e14baffb.zip
• ADDED copyAsRTF: to preserve syntax highlighting while copying
- not yet bound to any user interaction
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r--Source/CMTextView.m19
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 7685728d..d560e233 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -501,6 +501,25 @@ YY_BUFFER_STATE yy_scan_string (const char *);
[self insertText:@""];
}
+/*
+ * Copy selected text chunk as RTF to preserve syntax highlighting
+ */
+- (void)copyAsRTF:(id)sender
+{
+
+ NSPasteboard *pb = [NSPasteboard generalPasteboard];
+ NSTextStorage *textStorage = [self textStorage];
+ NSData *rtf = [textStorage RTFFromRange:[self selectedRange]
+ documentAttributes:nil];
+
+ if (rtf)
+ {
+ [pb declareTypes:[NSArray arrayWithObject:NSRTFPboardType] owner:self];
+ [pb setData:rtf forType:NSRTFPboardType];
+ }
+
+}
+
/*
List of keywords for autocompletion. If you add a keyword here,