summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java
index 3ea2fb46d2..82c66ce803 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java
@@ -702,11 +702,15 @@ boolean acceptsFirstResponder(int /*long*/ id, int /*long*/ sel) {
*/
public Point getCaretLocation () {
checkWidget ();
+ NSTextView widget = null;
if ((style & SWT.SINGLE) != 0) {
- //TODO - caret location for single text
- return new Point (0, 0);
+ if (this.hasFocus()) {
+ widget = new NSTextView(view.window().fieldEditor(true, view));
+ }
+ } else {
+ widget = (NSTextView) view;
}
- NSTextView widget = (NSTextView)view;
+ if (widget == null) return new Point (0, 0);
NSLayoutManager layoutManager = widget.layoutManager();
NSTextContainer container = widget.textContainer();
NSRange range = widget.selectedRange();