summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schuster <theBohemian@gmx.net>2006-03-06 02:29:01 +0000
committerRobert Schuster <theBohemian@gmx.net>2006-03-06 02:29:01 +0000
commit883632351558eb13c07ac21f5346c78500da3344 (patch)
tree0589a3aa7e78fe1776cda79fa1ac1cf61d3e3fae
parentb492b85ef9e5135cdcf4dffdc194d85b15add5ad (diff)
downloadclasspath-883632351558eb13c07ac21f5346c78500da3344.tar.gz
2006-03-06 Robert Schuster <robertschuster@fsfe.org>
* javax/swing/plaf/basic/BasicTextUI.java: (damageRange): Rewritten if-expressions to correctly identify the break condition.
-rw-r--r--ChangeLog6
-rw-r--r--javax/swing/plaf/basic/BasicTextUI.java13
2 files changed, 17 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index e9e5a4ca8..3ae2935ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2006-03-06 Robert Schuster <robertschuster@fsfe.org>
+ * javax/swing/plaf/basic/BasicTextUI.java:
+ (damageRange): Rewritten if-expressions to correctly identify the
+ break condition.
+
+2006-03-06 Robert Schuster <robertschuster@fsfe.org>
+
* javax/swing/text/DefaultCaret.java:
(mouseDragged): Do selection when shift is pressed.
(mouseClicked): Implemented.
diff --git a/javax/swing/plaf/basic/BasicTextUI.java b/javax/swing/plaf/basic/BasicTextUI.java
index beb1a6dfe..181e52022 100644
--- a/javax/swing/plaf/basic/BasicTextUI.java
+++ b/javax/swing/plaf/basic/BasicTextUI.java
@@ -1023,7 +1023,11 @@ public abstract class BasicTextUI extends TextUI
// we should stop searching for one.
int posBelow = Utilities.getPositionBelow(t, p0, l1.x);
- if (posBelow < p1 && posBelow != -1 && posBelow != p0)
+ int p1RowStart = Utilities.getRowStart(t, p1);
+
+ if (posBelow != -1
+ && posBelow != p0
+ && Utilities.getRowStart(t, posBelow) != p1RowStart)
{
// Take the rectangle of the offset we just found and grow it
// to the maximum width. Retain y because this is our start
@@ -1034,10 +1038,15 @@ public abstract class BasicTextUI extends TextUI
// Find further lines which have to be damaged completely.
int nextPosBelow = posBelow;
- while (nextPosBelow < p1 && nextPosBelow != -1 && posBelow != nextPosBelow)
+ while (nextPosBelow != -1
+ && posBelow != nextPosBelow
+ && Utilities.getRowStart(t, nextPosBelow) != p1RowStart)
{
posBelow = nextPosBelow;
nextPosBelow = Utilities.getPositionBelow(t, posBelow, l1.x);
+
+ if (posBelow == nextPosBelow)
+ break;
}
// Now posBelow is an offset on the last line which has to be damaged
// completely. (newPosBelow is on the same line as p1)