diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-04-03 08:57:28 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-04-03 08:57:28 +0000 |
commit | 4e687203f03dda7b0af9aa0433b80231e14baffb (patch) | |
tree | 531627a8ce96b88a740c9c2301f59b648f9a5003 | |
parent | bdf4a64d1b0b337c7dfe9af89debd9f6024d599a (diff) | |
download | sequelpro-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
-rw-r--r-- | Source/CMTextView.m | 19 |
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, |