I noticed that the PasswordView did draw one character too much.
Investigation showed that the mistake is in PlainView.drawLine(), where
we used to call drawUnselectedText() with startOffset and endOffset,
whereas it should be endOffset - 1 (because endOffset is actually the
position _after_ the last character in the element).

2006-02-08  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/text/PlainView.java
        (drawLine): Call drawUnselectedText() with end offset - 1 to avoid
        drawing unnecessary characters.

/Roman
Index: javax/swing/text/PlainView.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/PlainView.java,v
retrieving revision 1.35
diff -u -r1.35 PlainView.java
--- javax/swing/text/PlainView.java	31 Jan 2006 10:03:32 -0000	1.35
+++ javax/swing/text/PlainView.java	8 Feb 2006 15:53:53 -0000
@@ -46,7 +46,6 @@
 import java.awt.Rectangle;
 import java.awt.Shape;
 
-import javax.swing.SwingConstants;
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentEvent.ElementChange;
 
@@ -153,7 +152,8 @@
         metrics = g.getFontMetrics();
         // FIXME: Selected text are not drawn yet.
         Element line = getElement().getElement(lineIndex);
-        drawUnselectedText(g, x, y, line.getStartOffset(), line.getEndOffset());
+        drawUnselectedText(g, x, y, line.getStartOffset(),
+                           line.getEndOffset() - 1);
         //drawSelectedText(g, , , , );
       }
     catch (BadLocationException e)

Reply via email to