From 21a85b41f5c1c26f952db6e604e4efdfcf4f2b15 Mon Sep 17 00:00:00 2001
From: Felipe Heidrich <fheidric>
Date: Thu, 17 Feb 2011 16:44:03 +0000
Subject: removing unnecessary if statements (Bug 101654 - [typing] [Ctrl+]
 Home/End doesn't reveal caret if already at position)

---
 .../common/org/eclipse/swt/custom/StyledText.java  | 24 ++++++++--------------
 1 file changed, 8 insertions(+), 16 deletions(-)

(limited to 'bundles')

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 430f46ceb3..2cc14aabe2 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	
@@ -2466,20 +2466,16 @@ void doContentEnd() {
 		doLineEnd();
 	} else {
 		int length = content.getCharCount();		
-		if (caretOffset <= length) {
-			setCaretOffset(length, SWT.DEFAULT);
-			showCaret();
-		}
+		setCaretOffset(length, SWT.DEFAULT);
+		showCaret();
 	}
 }
 /**
  * Moves the caret in front of the first character of the widget content.
  */
 void doContentStart() {
-	if (caretOffset >= 0) {
-		setCaretOffset(0, SWT.DEFAULT);
-		showCaret();
-	}
+	setCaretOffset(0, SWT.DEFAULT);
+	showCaret();
 }
 /**
  * Moves the caret to the start of the selection if a selection exists.
@@ -2633,10 +2629,8 @@ void doLineEnd() {
 		int lineLength = content.getLine(caretLine).length();
 		lineEndOffset = lineOffset + lineLength;
 	}
-	if (caretOffset <= lineEndOffset) {
-		setCaretOffset(lineEndOffset, PREVIOUS_OFFSET_TRAILING);
-		showCaret();
-	}
+	setCaretOffset(lineEndOffset, PREVIOUS_OFFSET_TRAILING);
+	showCaret();
 }
 /**
  * Moves the caret to the beginning of the line.
@@ -2652,10 +2646,8 @@ void doLineStart() {
 		lineOffset += offsets[lineIndex];
 		renderer.disposeTextLayout(layout);
 	}
-	if (caretOffset >= lineOffset) {
-		setCaretOffset(lineOffset, OFFSET_LEADING);
-		showCaret();
-	}
+	setCaretOffset(lineOffset, OFFSET_LEADING);
+	showCaret();
 }
 /**
  * Moves the caret one line up and to the same character offset relative 
-- 
cgit