diff options
Diffstat (limited to 'cocoa')
| -rw-r--r-- | cocoa/ScintillaCocoa.h | 2 | ||||
| -rw-r--r-- | cocoa/ScintillaCocoa.mm | 6 | ||||
| -rw-r--r-- | cocoa/ScintillaView.mm | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h index f34d7c31d..0eb758ddc 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -197,7 +197,7 @@ public: void ObserverRemove(); void IdleWork() override; void QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo) override; - ptrdiff_t InsertText(NSString *input); + ptrdiff_t InsertText(NSString *input, CharacterSource charSource); NSRange PositionsFromCharacters(NSRange rangeCharacters) const; NSRange CharactersFromPositions(NSRange rangePositions) const; NSString *RangeTextAsString(NSRange rangePositions) const; diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 0ce912f54..bc6bb3698 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -2175,7 +2175,7 @@ bool ScintillaCocoa::KeyboardInput(NSEvent *event) { /** * Used to insert already processed text provided by the Cocoa text input system. */ -ptrdiff_t ScintillaCocoa::InsertText(NSString *input) { +ptrdiff_t ScintillaCocoa::InsertText(NSString *input, CharacterSource charSource) { if ([input length] == 0) { return 0; } @@ -2190,7 +2190,7 @@ ptrdiff_t ScintillaCocoa::InsertText(NSString *input) { while (sv.length()) { const unsigned char leadByte = sv[0]; const unsigned int bytesInCharacter = UTF8BytesOfLead[leadByte]; - InsertCharacter(sv.substr(0, bytesInCharacter)); + InsertCharacter(sv.substr(0, bytesInCharacter), charSource); sv.remove_prefix(bytesInCharacter); } return encoded.length(); @@ -2203,7 +2203,7 @@ ptrdiff_t ScintillaCocoa::InsertText(NSString *input) { std::string encoded = EncodedBytesString((__bridge CFStringRef)character, encoding); lengthInserted += encoded.length(); - InsertCharacter(encoded); + InsertCharacter(encoded, charSource); } return lengthInserted; diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index 08eb0aa12..7d9e7780b 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -529,7 +529,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) { else if ([aString isKindOfClass: [NSAttributedString class]]) newText = (NSString *) [aString string]; - mOwner.backend->InsertText(newText); + mOwner.backend->InsertText(newText, EditModel::CharacterSource::directInput); } //-------------------------------------------------------------------------------------------------- @@ -622,7 +622,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) { NSRange posRangeCurrent = mOwner.backend->PositionsFromCharacters(NSMakeRange(replacementRange.location, 0)); // Note: Scintilla internally works almost always with bytes instead chars, so we need to take // this into account when determining selection ranges and such. - ptrdiff_t lengthInserted = mOwner.backend->InsertText(newText); + ptrdiff_t lengthInserted = mOwner.backend->InsertText(newText, EditModel::CharacterSource::tentativeInput); posRangeCurrent.length = lengthInserted; mMarkedTextRange = mOwner.backend->CharactersFromPositions(posRangeCurrent); // Mark the just inserted text. Keep the marked range for later reset. @@ -1965,9 +1965,9 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) { - (void) insertText: (id) aString { if ([aString isKindOfClass: [NSString class]]) - mBackend->InsertText(aString); + mBackend->InsertText(aString, EditModel::CharacterSource::directInput); else if ([aString isKindOfClass: [NSAttributedString class]]) - mBackend->InsertText([aString string]); + mBackend->InsertText([aString string], EditModel::CharacterSource::directInput); } //-------------------------------------------------------------------------------------------------- |
