diff options
author | Carolyn MacLeod <carolyn> | 2010-08-30 17:59:24 +0000 |
---|---|---|
committer | Carolyn MacLeod <carolyn> | 2010-08-30 17:59:24 +0000 |
commit | e4c6722ce8a9b50e51699ca4bd9c3e13019de899 (patch) | |
tree | 1699e113f7d9209934c4e66525c99b61a7130df8 | |
parent | 0319b21f0d8e9b97ce700e4326445fc4879c0889 (diff) | |
download | eclipse.platform.swt-e4c6722ce8a9b50e51699ca4bd9c3e13019de899.tar.gz eclipse.platform.swt-e4c6722ce8a9b50e51699ca4bd9c3e13019de899.tar.xz eclipse.platform.swt-e4c6722ce8a9b50e51699ca4bd9c3e13019de899.zip |
Bug 323995 - [Accessibility] StyledText selection incorrect after caret moved event
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java index 1aa51e8159..c6915a2151 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java @@ -167,6 +167,7 @@ public class StyledText extends Canvas { int lineSpacing; int alignmentMargin; int newOrientation = SWT.NONE; + int accCaretOffset; //block selection boolean blockSelection; @@ -2408,6 +2409,7 @@ void doBlockSelection(boolean sendEvent) { if (sendEvent) { sendSelectionEvent(); } + sendAccessibleTextCaretMoved(); } /** * Replaces the selection with the character or insert the character at the @@ -3216,6 +3218,7 @@ void doSelection(int direction) { internalRedrawRange(redrawStart, redrawEnd - redrawStart); sendSelectionEvent(); } + sendAccessibleTextCaretMoved(); } /** * Moves the caret to the next character or to the beginning of the @@ -7795,6 +7798,7 @@ void resetCache(int firstLine, int count) { void resetSelection() { selection.x = selection.y = caretOffset; selectionAnchor = -1; + sendAccessibleTextCaretMoved(); } public void scroll(int destX, int destY, int x, int y, int width, int height, boolean all) { @@ -7929,6 +7933,12 @@ void scrollText(int srcY, int destY) { super.redraw(leftMargin, clientAreaHeight - bottomMargin, scrollWidth, bottomMargin, false); } } +void sendAccessibleTextCaretMoved() { + if (caretOffset != accCaretOffset) { + accCaretOffset = caretOffset; + getAccessible().textCaretMoved(caretOffset); + } +} void sendAccessibleTextChanged(int start, int newCharCount, int replaceCharCount) { Accessible accessible = getAccessible(); if (replaceCharCount != 0) { @@ -8435,7 +8445,6 @@ void setCaretOffset(int offset, int alignment) { event.end = caretOffset; notifyListeners(CaretMoved, event); } - getAccessible().textCaretMoved(caretOffset); } if (alignment != SWT.DEFAULT) { caretAlignment = alignment; @@ -9480,6 +9489,7 @@ void setSelection(int start, int length, boolean sendEvent, boolean doBlock) { setCaretOffset(end, PREVIOUS_OFFSET_TRAILING); } internalRedrawRange(selection.x, selection.y - selection.x); + sendAccessibleTextCaretMoved(); } } } |