aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2013-04-09 15:25:26 +1000
committernyamatongwe <unknown>2013-04-09 15:25:26 +1000
commit5a3c37478d29afff6d1e53f4c9c901be5bbadcbb (patch)
treed2acb3cb3a70a7df7a7b161c9ce1567f4f264b29
parent3c46538bb90f861844d1f4c7b09959da7465ee23 (diff)
parent553a78b81d0deeb96940a7486074364e75d50068 (diff)
downloadscintilla-mirror-5a3c37478d29afff6d1e53f4c9c901be5bbadcbb.tar.gz
Merged Cocoa composition fix.
-rw-r--r--cocoa/ScintillaCocoa.h3
-rw-r--r--cocoa/ScintillaCocoa.mm15
-rw-r--r--cocoa/ScintillaView.mm5
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;