aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'cocoa')
-rw-r--r--cocoa/ScintillaView.mm26
1 files changed, 19 insertions, 7 deletions
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm
index 09f290b1e..4cebd7e9e 100644
--- a/cocoa/ScintillaView.mm
+++ b/cocoa/ScintillaView.mm
@@ -239,9 +239,15 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
*/
- (void) insertText: (id) aString
{
- // Remove any previously marked text first.
- [self removeMarkedText];
- mOwner.backend->InsertText((NSString*) aString);
+ // Remove any previously marked text first.
+ [self removeMarkedText];
+ NSString* newText = @"";
+ if ([aString isKindOfClass:[NSString class]])
+ newText = (NSString*) aString;
+ else if ([aString isKindOfClass:[NSAttributedString class]])
+ newText = (NSString*) [aString string];
+
+ mOwner.backend->InsertText(newText);
}
//--------------------------------------------------------------------------------------------------
@@ -274,7 +280,12 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
{
// Since we did not return any valid attribute for marked text (see validAttributesForMarkedText)
// we can safely assume the passed in text is an NSString instance.
- NSString* newText = (NSString*) aString;
+ NSString* newText = @"";
+ if ([aString isKindOfClass:[NSString class]])
+ newText = (NSString*) aString;
+ else if ([aString isKindOfClass:[NSAttributedString class]])
+ newText = (NSString*) [aString string];
+
int currentPosition = [mOwner getGeneralProperty: SCI_GETCURRENTPOS parameter: 0];
// Replace marked text if there is one.
@@ -363,7 +374,8 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
*/
- (void) keyDown: (NSEvent *) theEvent
{
- mOwner.backend->KeyboardInput(theEvent);
+ if (mMarkedTextRange.length == 0)
+ mOwner.backend->KeyboardInput(theEvent);
NSArray* events = [NSArray arrayWithObject: theEvent];
[self interpretKeyEvents: events];
}
@@ -777,9 +789,9 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
// Setup a special indicator used in the editor to provide visual feedback for
// input composition, depending on language, keyboard etc.
- [self setColorProperty: SCI_INDICSETFORE parameter: INPUT_INDICATOR fromHTML: @"#FF9A00"];
+ [self setColorProperty: SCI_INDICSETFORE parameter: INPUT_INDICATOR fromHTML: @"#FF0000"];
[self setGeneralProperty: SCI_INDICSETUNDER parameter: INPUT_INDICATOR value: 1];
- [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INPUT_INDICATOR value: INDIC_ROUNDBOX];
+ [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INPUT_INDICATOR value: INDIC_PLAIN];
[self setGeneralProperty: SCI_INDICSETALPHA parameter: INPUT_INDICATOR value: 100];
}
return self;