diff --git a/app/src/processing/app/syntax/JEditTextArea.java b/app/src/processing/app/syntax/JEditTextArea.java index fae0698cc..8a76a9d33 100644 --- a/app/src/processing/app/syntax/JEditTextArea.java +++ b/app/src/processing/app/syntax/JEditTextArea.java @@ -1151,7 +1151,11 @@ public class JEditTextArea extends JComponent newBias = true; } - if(newStart < 0 || newEnd > getDocumentLength()) + if (newEnd > getDocumentLength()) { + newEnd = getDocumentLength(); + } + + if(newStart < 0) { throw new IllegalArgumentException("Bounds out of" + " range: " + newStart + "," +