Menu

#4011 The Cut Lines macro gives exception if the cursor is beyond text area

normal bug
closed-fixed
None
5
2017-10-17
2016-08-15
No

If the cursor is on a line beyond the last line of text, the Cut Liners macro throws an exception. The fix for the exception is to change the Cut Lines macro to read:

cutLines(){
if (buffer.getLength() == 0)
return;
selections = textArea.getSelectedLines();

if(selections.length == 0){
    selections = new int [] {textArea.getCaretLine()};
}
start = textArea.getLineStartOffset(selections[0]);
stop = textArea.getLineEndOffset(selections[selections.length-1]);
blen = textArea.getBufferLength();
if (start < blen && stop <= blen)
    {
    textArea.setSelection(new Selection.Range(start,stop));
    Registers.cut(textArea,'$');
    }

}

The jedit version is 5.3.1 using Java 1.8.0_91.

Discussion

  • Roman Tsourick

    Roman Tsourick - 2017-10-09

    Here is my solution as a patch which also works for the last line

    https://sourceforge.net/p/jedit/patches/600/

     
  • Alan Ezust

    Alan Ezust - 2017-10-15
    • assigned_to: Roman Tsourick
     
  • Alan Ezust

    Alan Ezust - 2017-10-15

    you can close another ticket, Roman. thanks for your contribution.

     
  • Roman Tsourick

    Roman Tsourick - 2017-10-17
    • status: open --> closed-fixed
     

Log in to post a comment.