fix(gui): handle syntax parsing errors during search (#2669)

This commit is contained in:
Skylot
2025-10-21 20:55:01 +01:00
parent 2e93656007
commit 06a118c104
@@ -428,11 +428,16 @@ public abstract class AbstractCodeArea extends RSyntaxTextArea {
* @param str - if null -> reset current highlights
*/
private void highlightAllMatches(@Nullable String str) {
SearchContext context = new SearchContext(str);
context.setMarkAll(true);
context.setMatchCase(true);
context.setWholeWord(true);
SearchEngine.markAll(this, context);
try {
SearchContext context = new SearchContext(str);
context.setMarkAll(true);
context.setMatchCase(true);
context.setWholeWord(true);
SearchEngine.markAll(this, context);
} catch (Throwable e) {
// syntax parsing can fail for incorrect code
LOG.debug("Search highlight failed", e);
}
}
public @Nullable JumpPosition getCurrentPosition() {