You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(editor): prevent length mismatch assertion error in QueryaHighlightController for scripts > 8KB #909
In QueryaHighlightController.buildTextSpan (lib/core/editor/querya_highlight_controller.dart, lines 70–82):
When editing text whose length exceeds kSyntaxHighlightIsolateThreshold (8192 characters), syntax highlighting is offloaded to an isolate with a 100ms debounce.
While waiting for the background isolate to complete:
If the user is actively typing or deleting characters, _cachedSpan holds the TextSpan from the previous text version (_cachedText), while text has changed.
Flutter's RenderEditable requires that span.toPlainText() == text. Returning a stale _cachedSpan with mismatched length causes Assertion failed: span.toPlainText() == text in debug mode, and corrupts cursor rendering and selection offsets in release mode.
Repro
Open a SQL script larger than 8 KB in Querya SQL Editor.
Type or delete characters in the editor.
Observe AssertionError: span.toPlainText() == text or cursor offset jumping while typing before the 100ms debounce finishes.
Scope
In QueryaHighlightController.buildTextSpan, verify _cachedText == text before returning _cachedSpan.
Fall back to plain TextSpan(style: style, text: text) while new highlight tokens are pending from the isolate.
Out of scope
Grammar parsing logic in syntax_highlight package.
Activity
ZhuchkaTriplesix commentedon Sep 27, 2026
Resolved by #944 (already merged into
dev; not auto-closed since this repo's default branch ismainand PRs merge intodev).