diff options
-rw-r--r-- | cocoa/ScintillaCocoa.h | 3 | ||||
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 15 | ||||
-rw-r--r-- | cocoa/ScintillaView.mm | 5 |
3 files changed, 22 insertions, 1 deletions
diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h index 0c0448118..5aaa386d2 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -198,7 +198,8 @@ public: virtual void IdleWork(); virtual void QueueIdleWork(WorkNeeded::workItems items, int upTo); int InsertText(NSString* input); - + void SelectOnlyMainSelection(); + bool KeyboardInput(NSEvent* event); void MouseDown(NSEvent* event); void MouseMove(NSEvent* event); diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index e348488ff..dfe2e47d1 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -1917,6 +1917,21 @@ int ScintillaCocoa::InsertText(NSString* input) //-------------------------------------------------------------------------------------------------- /** + * Used to ensure that only one selection is active for input composition as composition + * does not support multi-typing. + * Also drop virtual space as that is not supported by composition. + */ +void ScintillaCocoa::SelectOnlyMainSelection() +{ + SelectionRange mainSel = sel.RangeMain(); + mainSel.ClearVirtualSpace(); + sel.SetSelection(mainSel); + Redraw(); +} + +//-------------------------------------------------------------------------------------------------- + +/** * Called by the owning view when the mouse pointer enters the control. */ void ScintillaCocoa::MouseEntered(NSEvent* event) diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index f9496cac1..48ccdf1ef 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -401,6 +401,11 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) value: mMarkedTextRange.location + mMarkedTextRange.length]; currentPosition = mMarkedTextRange.location; } + else + { + // Ensure only a single selection + mOwner.backend->SelectOnlyMainSelection(); + } // Keep Scintilla from collecting undo actions for the composition task. undoCollectionWasActive = [mOwner getGeneralProperty: SCI_GETUNDOCOLLECTION] != 0; |