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 9a74cb6f3..7e91f4c1a 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -199,7 +199,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 b1b44ea00..b40743dad 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -2279,7 +2279,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) { CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), vs.styles[STYLE_DEFAULT].characterSet); std::string encoded = EncodedBytesString((CFStringRef)input, encoding); @@ -2292,11 +2292,11 @@ ptrdiff_t ScintillaCocoa::InsertText(NSString *input) { while (sv.length()) { const unsigned char leadByte = sv[0]; const unsigned int bytesInCharacter = UTF8BytesOfLead[leadByte]; - InsertCharacter(sv.c_str(), bytesInCharacter); + InsertCharacter(sv.c_str(), bytesInCharacter, charSource); sv = sv.substr(bytesInCharacter, sv.length()); } } else { - InsertCharacter(encoded.c_str(), static_cast<unsigned int>(encoded.length())); + InsertCharacter(encoded.c_str(), static_cast<unsigned int>(encoded.length()), charSource); } } return encoded.length(); diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index ad8d7dc01..12e0495d6 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -565,7 +565,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); } //-------------------------------------------------------------------------------------------------- @@ -674,7 +674,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. @@ -2139,9 +2139,9 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context - (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); } //-------------------------------------------------------------------------------------------------- |