diff options
author | Knut Radloff <knutr> | 2001-11-15 22:40:53 +0000 |
---|---|---|
committer | Knut Radloff <knutr> | 2001-11-15 22:40:53 +0000 |
commit | 980206418530e005b05903ae9f54d0f8445c976f (patch) | |
tree | f77f3093b0859273fbe15a360c16588fc79c2148 | |
parent | 5a1c71b89899ab31c0f87fd0b3cee1b40ad0903c (diff) | |
download | eclipse.platform.swt-980206418530e005b05903ae9f54d0f8445c976f.tar.gz eclipse.platform.swt-980206418530e005b05903ae9f54d0f8445c976f.tar.xz eclipse.platform.swt-980206418530e005b05903ae9f54d0f8445c976f.zip |
5599
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java | 22 |
1 files changed, 18 insertions, 4 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 b344782200..639332a7f7 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 @@ -4031,7 +4031,7 @@ public String getTextRange(int start, int length) { int contentLength = getCharCount();
int end = start + length;
- if (start < 0 || start > contentLength || end < 0 || end > contentLength || start > end) {
+ if (start > end || start < 0 || end > contentLength) {
SWT.error(SWT.ERROR_INVALID_RANGE);
}
return content.getTextRange(start, length);
@@ -5358,12 +5358,26 @@ void redrawMultiLineChange(int y, int newLineCount, int replacedLineCount) { * of change that has taken place. If font styles or background colors for the redraw
* area have changed, clearBackground should be set to true. If only foreground colors
* have changed for the redraw area, clearBackground can be set to false.
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE when start and/or end are outside the widget content</li>
+ * </ul>
*/
public void redrawRange(int start, int length, boolean clearBackground) {
checkWidget();
- int firstLine = content.getLineAtOffset(start);
- int lastLine = content.getLineAtOffset(start + length);
+ int end = start + length;
+ int contentLength = content.getCharCount();
+ int firstLine;
+ int lastLine;
+ if (start > end || start < 0 || end > contentLength) {
+ SWT.error(SWT.ERROR_INVALID_RANGE);
+ }
+ firstLine = content.getLineAtOffset(start);
+ lastLine = content.getLineAtOffset(end);
// reset all affected lines but let the redraw recalculate only
// those that are visible.
contentWidth.reset(firstLine, lastLine - firstLine + 1, true);
@@ -5571,7 +5585,7 @@ public void replaceTextRange(int start, int length, String text) { int end = start + length;
Event event = new Event();
- if (start < 0 || start > contentLength || end < 0 || end > contentLength || start > end) {
+ if (start > end || start < 0 || end > contentLength) {
SWT.error(SWT.ERROR_INVALID_RANGE);
}
if (text == null) {
|