Hello everybody,
This is my first contribution, a small patch which eliminates the exception.
The bug reporter was not fully accurate saying "If the cursor is on a line beyond the last line of text" because error is triggered when the cursor is on the last line at any position (or, if multiline, selected block ends on the last line). What happens is that the block or line is first selected and then cut. This process fails in JEditBuffer.java at getLineOfOffset(int offset).
public int getLineOfOffset(int offset) { try { readLock(); if(offset < 0 || offset > getLength()) throw new ArrayIndexOutOfBoundsException(offset); return lineMgr.getLineOfOffset(offset); } finally { readUnlock(); } } //}}}
Offset can not be greater than textArea buffer length, while it is greater by one for the last line which results in an exception.
So we just adjust "stop" value (selection ending) when it is beyond buffer length.
Committed 24764.