diff options
author | Neil Hodgson <nyamatongwe@gmail.com> | 2014-07-10 14:46:05 +1000 |
---|---|---|
committer | Neil Hodgson <nyamatongwe@gmail.com> | 2014-07-10 14:46:05 +1000 |
commit | 0aaf5f1957bfd366c184fa6de7a8c3dad1d97acc (patch) | |
tree | b7dce549068516b73e32aa2eddd626145f059189 | |
parent | 29165cf68134ce1c0e279dfed6e524523b1215b5 (diff) | |
download | scintilla-mirror-0aaf5f1957bfd366c184fa6de7a8c3dad1d97acc.tar.gz |
Fix the insertText: method on ScintillaView to accept NSAttributedString as well as NSString,
since insertText: is from the NSResponder superclass where it is defined to accept both.
-rw-r--r-- | cocoa/ScintillaView.h | 2 | ||||
-rw-r--r-- | cocoa/ScintillaView.mm | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/cocoa/ScintillaView.h b/cocoa/ScintillaView.h index f3a76e322..419c2f28f 100644 --- a/cocoa/ScintillaView.h +++ b/cocoa/ScintillaView.h @@ -135,7 +135,7 @@ extern NSString *const SCIUpdateUINotification; // NSTextView compatibility layer. - (NSString*) string; - (void) setString: (NSString*) aString; -- (void) insertText: (NSString*) aString; +- (void) insertText: (id) aString; - (void) setEditable: (BOOL) editable; - (BOOL) isEditable; - (NSRange) selectedRange; diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index bca3b167f..2ca7ed6bc 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -1658,9 +1658,12 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) //-------------------------------------------------------------------------------------------------- -- (void)insertText: (NSString*)text +- (void)insertText: (id) aString { - mBackend->InsertText(text); + if ([aString isKindOfClass:[NSString class]]) + mBackend->InsertText(aString); + else if ([aString isKindOfClass:[NSAttributedString class]]) + mBackend->InsertText([aString string]); } //-------------------------------------------------------------------------------------------------- |