Hi, the magic caret position can be null when the cursor has not moved yet. I havent considered this when writing the up/down movement & selection actions. This patch fixes that.
The ChangeLog: 2006-02-22 Robert Schuster <[EMAIL PROTECTED]> * javax/swing/text/DefaultEditorKit.java: Added checks and fallback behavior when magic caret position is null. cya Robert
Index: javax/swing/text/DefaultEditorKit.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultEditorKit.java,v retrieving revision 1.30 diff -u -r1.30 DefaultEditorKit.java --- javax/swing/text/DefaultEditorKit.java 20 Feb 2006 21:18:38 -0000 1.30 +++ javax/swing/text/DefaultEditorKit.java 22 Feb 2006 10:38:03 -0000 @@ -863,7 +863,10 @@ if (t != null) { Caret c = t.getCaret(); - int x = c.getMagicCaretPosition().x; + // The magic caret position may be null when the caret + // has not moved yet. + Point mcp = c.getMagicCaretPosition(); + int x = (mcp != null) ? mcp.x : 0; int pos = Utilities.getPositionAbove(t, t.getCaretPosition(), x); if (pos > -1) @@ -886,7 +889,10 @@ if (t != null) { Caret c = t.getCaret(); - int x = c.getMagicCaretPosition().x; + // The magic caret position may be null when the caret + // has not moved yet. + Point mcp = c.getMagicCaretPosition(); + int x = (mcp != null) ? mcp.x : 0; int pos = Utilities.getPositionBelow(t, t.getCaretPosition(), x); if (pos > -1) @@ -959,7 +965,10 @@ if (t != null) { Caret c = t.getCaret(); - int x = c.getMagicCaretPosition().x; + // The magic caret position may be null when the caret + // has not moved yet. + Point mcp = c.getMagicCaretPosition(); + int x = (mcp != null) ? mcp.x : 0; int pos = Utilities.getPositionAbove(t, t.getCaretPosition(), x); if (pos > -1) @@ -982,7 +991,10 @@ if (t != null) { Caret c = t.getCaret(); - int x = c.getMagicCaretPosition().x; + // The magic caret position may be null when the caret + // has not moved yet. + Point mcp = c.getMagicCaretPosition(); + int x = (mcp != null) ? mcp.x : 0; int pos = Utilities.getPositionBelow(t, t.getCaretPosition(), x); if (pos > -1)
signature.asc
Description: OpenPGP digital signature