Skip to content

Commit 586e7d5

Browse files
magedrifaatcmaglie
authored andcommitted
Fix wrong bracket match rectangle on auto format
This commit fixes instances when setText is called on editorTab and the rectangle that highlights the bracket match becomes incorrect. This is because text is inserted to the document without notifying the textarea. Calling setLineWrap internally fires an event that recalculates the bracket match rectangle and thus solves the problem.
1 parent 0dde85e commit 586e7d5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/src/processing/app/EditorTab.java

+3
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,9 @@ public void setText(String what) {
442442
} finally {
443443
caret.setUpdatePolicy(policy);
444444
}
445+
// A trick to force textarea to recalculate the bracket matching rectangle.
446+
// In the worst case scenario, this should be ineffective.
447+
textarea.setLineWrap(textarea.getLineWrap());
445448
}
446449

447450
/**

0 commit comments

Comments
 (0)