diff --git a/app/src/main/java/org/autojs/autojs/ui/edit/editor/CodeEditText.java b/app/src/main/java/org/autojs/autojs/ui/edit/editor/CodeEditText.java index 534a9229e..7fa4df6d4 100644 --- a/app/src/main/java/org/autojs/autojs/ui/edit/editor/CodeEditText.java +++ b/app/src/main/java/org/autojs/autojs/ui/edit/editor/CodeEditText.java @@ -285,7 +285,12 @@ private void drawText(Canvas canvas) { //postInvalidate(); return; } - canvas.drawText(text, previousColorPos, visibleCharEnd, paddingLeft + offsetX, lineBaseline, paint); + try { + canvas.drawText(text, previousColorPos, visibleCharEnd, paddingLeft + offsetX, lineBaseline, paint); + } catch (Exception e) { + Log.e(LOG_TAG, String.format("drawText: %s\nPreviousColorPos: %d\nVisibleCharEnd: %d\nX Position: %s\nY Position: %d\nlineStart = %d, lineEnd = %d, visibleCharStart = %d, visibleCharEnd = %d", e, previousColorPos, visibleCharEnd, paddingLeft + offsetX, lineBaseline, lineStart, lineEnd, visibleCharStart, visibleCharEnd)); + return; + } if (DEBUG) { mLogger.addSplit("draw line " + line + " (" + (visibleCharEnd - visibleCharStart) + ") "); } @@ -438,7 +443,7 @@ public void updateHighlightTokens(JavaScriptHighlighter.HighlightTokens highligh return; } mHighlightTokens = highlightTokens; - Log.d(LOG_TAG, "updateHighlightTokens: tokens = " + highlightTokens); +// Log.d(LOG_TAG, "updateHighlightTokens: tokens = " + highlightTokens); postInvalidate(); }