If the text area does not have enough lines to fill itself and the user presses
the End key, repaint() will fail with ArrayIndexOutOfBoundsException:
java.lang.ArrayIndexOutOfBoundsException: -24
at java.util.ArrayList.elementData(ArrayList.java:371)
at java.util.ArrayList.get(ArrayList.java:384)
at com.googlecode.lanterna.gui.component.TextArea.repaint(TextArea.java:119)
at com.googlecode.lanterna.gui.component.Panel.repaint(Panel.java:147)
at com.googlecode.lanterna.gui.Window.repaint(Window.java:133)
at com.googlecode.lanterna.gui.GUIScreen.repaint(GUIScreen.java:187)
at com.googlecode.lanterna.gui.GUIScreen.update(GUIScreen.java:199)
at com.googlecode.lanterna.gui.GUIScreen.doEventLoop(GUIScreen.java:237)
at com.googlecode.lanterna.gui.GUIScreen.showWindow(GUIScreen.java:309)
This is because keyboardInteraction() does not prevent scrollTopIndex from
being set below zero:
case End:
scrollTopIndex = lines.size() - lastSize.getRows();
break;
Here is a simple fix:
case End:
scrollTopIndex = Math.max(0, lines.size() - lastSize.getRows());
break;
Thanks for the great library! It's a life saver.
Original issue reported on code.google.com by dboit...@gmail.com on 26 Aug 2013 at 9:17
Original issue reported on code.google.com by
dboit...@gmail.com
on 26 Aug 2013 at 9:17