1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-19 08:52:15 +01:00

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.
This commit is contained in:
Maged Ahmed Rifaat 2019-12-22 18:31:39 +02:00 committed by Cristian Maglie
parent 0dde85e417
commit 586e7d5fe8

View File

@ -442,6 +442,9 @@ public class EditorTab extends JPanel implements SketchFile.TextStorage {
} finally {
caret.setUpdatePolicy(policy);
}
// A trick to force textarea to recalculate the bracket matching rectangle.
// In the worst case scenario, this should be ineffective.
textarea.setLineWrap(textarea.getLineWrap());
}
/**