Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbhishek Kishore2014-06-16 11:55:56 +0000
committerAbhishek Kishore2014-07-08 06:26:50 +0000
commitd7358b2f165914812f728ab511c4265cd97974a9 (patch)
tree6473eae365c0277ec9bba96473767254126de6cc
parent82d44d22e81fd3fdece0fbbe0f34c8fcecae0d76 (diff)
downloadeclipse.platform.swt-d7358b2f165914812f728ab511c4265cd97974a9.tar.gz
eclipse.platform.swt-d7358b2f165914812f728ab511c4265cd97974a9.tar.xz
eclipse.platform.swt-d7358b2f165914812f728ab511c4265cd97974a9.zip
Bug 421246 - StyledText: incorrect caret move in first/last line (OS X)
Change-Id: Iac753a82d7f4b47e06e1812fb4b213c05f5ce008 Signed-off-by: Abhishek Kishore <abhishek.kishore@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java14
1 files changed, 6 insertions, 8 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 3a3ffcba05..c38111f828 100644
--- 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
@@ -2591,7 +2591,8 @@ void doDeleteWordPrevious() {
/**
* Moves the caret one line down and to the same character offset relative
* to the beginning of the line. Move the caret to the end of the new line
- * if the new line is shorter than the character offset.
+ * if the new line is shorter than the character offset. Moves the caret to
+ * the end of the text if the caret already is on the last line.
*/
void doLineDown(boolean select) {
int caretLine = getCaretLine();
@@ -2616,9 +2617,7 @@ void doLineDown(boolean select) {
caretLine++;
}
if (lastLine) {
- if (select) {
- setCaretOffset(content.getCharCount(), SWT.DEFAULT);
- }
+ setCaretOffset(content.getCharCount(), SWT.DEFAULT);
} else {
int[] alignment = new int[1];
int offset = getOffsetAtPoint(columnX, y, caretLine, alignment);
@@ -2677,7 +2676,8 @@ void doLineStart() {
/**
* Moves the caret one line up and to the same character offset relative
* to the beginning of the line. Move the caret to the end of the new line
- * if the new line is shorter than the character offset.
+ * if the new line is shorter than the character offset. Moves the caret to
+ * the beginning of the document if it is already on the first line.
*/
void doLineUp(boolean select) {
int caretLine = getCaretLine(), y = 0;
@@ -2702,9 +2702,7 @@ void doLineUp(boolean select) {
caretLine--;
}
if (firstLine) {
- if (select) {
- setCaretOffset(0, SWT.DEFAULT);
- }
+ setCaretOffset(0, SWT.DEFAULT);
} else {
int[] alignment = new int[1];
int offset = getOffsetAtPoint(columnX, y, caretLine, alignment);

Back to the top