summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover <steve>2005-10-31 19:55:03 +0000
committerSteve Northover <steve>2005-10-31 19:55:03 +0000
commitda903d02e1b75a5f0c828f3da113a06bf81caba0 (patch)
tree0a986a4c8ab7d2807bc96a62c251622d5c15d339
parentdf5cf3f6d5368a41b2c6ca2836151f5de25984e0 (diff)
downloadeclipse.platform.swt-da903d02e1b75a5f0c828f3da113a06bf81caba0.tar.gz
eclipse.platform.swt-da903d02e1b75a5f0c828f3da113a06bf81caba0.tar.xz
eclipse.platform.swt-da903d02e1b75a5f0c828f3da113a06bf81caba0.zip
111798 - Text#getCaretLocation() replaces selected text by " " iff caret is after last character
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
index a0a9789d79..cc9b0fc9ac 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
@@ -532,6 +532,10 @@ public Point getCaretLocation () {
if (caretPos == -1) {
caretPos = 0;
if (position >= OS.GetWindowTextLength (handle)) {
+ int cp = getCodePage ();
+ int [] start = new int [1], end = new int [1];
+ OS.SendMessage (handle, OS.EM_GETSEL, start, end);
+ OS.SendMessage (handle, OS.EM_SETSEL, position, position);
/*
* Feature in Windows. When an edit control with ES_MULTILINE
* style that does not have the WS_VSCROLL style is full (i.e.
@@ -544,12 +548,13 @@ public Point getCaretLocation () {
* handler from WM_CHAR.
*/
ignoreCharacter = ignoreModify = true;
- int cp = getCodePage ();
OS.SendMessage (handle, OS.EM_REPLACESEL, 0, new TCHAR (cp, " ", true));
caretPos = OS.SendMessage (handle, OS.EM_POSFROMCHAR, position, 0);
OS.SendMessage (handle, OS.EM_SETSEL, position, position + 1);
OS.SendMessage (handle, OS.EM_REPLACESEL, 0, new TCHAR (cp, "", true));
ignoreCharacter = ignoreModify = false;
+ OS.SendMessage (handle, OS.EM_SETSEL, start [0], start [0]);
+ OS.SendMessage (handle, OS.EM_SETSEL, start [0], end [0]);
}
}
return new Point ((short) (caretPos & 0xFFFF), (short) (caretPos >> 16));