bugKawa - Bugs: bug #33285, IllegalArgumentException after...


bug #33285: IllegalArgumentException after deleting to the beginning of the buffer

Submitted by:  Shad Gregory <shadgregory>
Submitted on:  Wed 11 May 2011 03:40:24 AM UTC  
Category:  JEmacs Severity:  3 - Normal
Item Group:  None Status:  Confirmed
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 30 Jun 2011 04:16:23 AM UTC, comment #1:

Oops. An embarrassing bug. But as you suspect, it's not the right fix. It would be much appreciated if you could figure out what the problem is.

I'm guessing the issue is related to "Position" objects (implemented by SwingContent.GapPosition) getting confused: some off-by-one error, or the isAfter property is as it should be. There may also be some confusion about "empty" buffer not being quite empty - it should still has a single newline.
The CharBuffer#dump method can be useful for debugging.

Per Bothner <bothner>
Project Administrator
Wed 11 May 2011 03:40:24 AM UTC, original submission:

1) type a character
2) backspace over the character (or Ctrl_A and Crtl-D)
3) try to type a new character
4) you will receive an error:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: offsetLimit must be after current position
at java.awt.font.LineBreakMeasurer.nextOffset(LineBreakMeasurer.java:355)
at java.awt.font.LineBreakMeasurer.nextLayout(LineBreakMeasurer.java:440)
at javax.swing.text.TextLayoutStrategy.sync(TextLayoutStrategy.java:315)
at javax.swing.text.TextLayoutStrategy.insertUpdate(TextLayoutStrategy.java:69)
at javax.swing.text.FlowView.insertUpdate(FlowView.java:256)
at javax.swing.text.View.forwardUpdateToView(View.java:1203)
at javax.swing.text.View.forwardUpdate(View.java:1178)
at javax.swing.text.BoxView.forwardUpdate(BoxView.java:240)
at javax.swing.text.View.insertUpdate(View.java:702)
at javax.swing.plaf.basic.BasicTextUI$RootView.insertUpdate(BasicTextUI.java:1607)
at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.insertUpdate(BasicTextUI.java:1866)
at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:202)
at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:751)
at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:710)
at gnu.jemacs.swing.SwingBuffer.insert(SwingBuffer.java:216)

I have attached a patch that corrects this problem, though I am certain that this is not the correct solution.

Shad Gregory <shadgregory>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #23384:  jemacs.diff added by shadgregory (453B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)
  • -email is unavailable- added by shadgregory (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-06-30 bothner StatusNone => Confirmed
    2011-05-11 shadgregory Attached File- => Added jemacs.diff, #23384

    Back to the top

    Powered by Savane 3.3