Skip to content

Commit

Permalink
fix: IllegalArgumentException in Colorizer event processing.
Browse files Browse the repository at this point in the history
The Colorizer should not process stale tokens if they go over the end of
the line in the current document. This prevents IllegalArgumentException
occurring when the Tokenizer thread runs slow or is delayed relative to
the textChanged notification in the reconciler.
  • Loading branch information
andrewL-avlq committed Jan 10, 2025
1 parent 83e998c commit d457dd7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void colorize(final IRegion damageRegion, final ITMDocumentModel tmModel) throws
List<TMToken> tokens = null;
for (int lineIndex = fromLineIndex; lineIndex <= toLineIndex; lineIndex++) {
tokens = tmModel.getLineTokens(lineIndex);
if (tokens == null) {
if (tokens == null || (!tokens.isEmpty() && tokens.get(tokens.size() - 1).startIndex > doc.getLineLength(lineIndex))) {
if (TMUIPlugin.isLogTraceEnabled())
TMUIPlugin.logTrace("TextMate tokens not yet available for line " + lineIndex);
continue;
Expand Down

0 comments on commit d457dd7

Please sign in to comment.