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
perf(editor): eliminate full string equality comparison on cursor movement in QueryaCodeEditor #1542
In QueryaCodeEditor._onTextChanged (lib/core/editor/querya_code_editor.dart), _effectiveController.addListener(_onTextChanged) is triggered on every cursor position change, arrow key navigation, and text selection update.
When currentText.length == _lastText.length, the method performs a full (N)$ string equality check currentText == _lastText across the entire document.
For 100KB-1MB SQL scripts, every arrow key press or selection shift runs a heavy string scan, causing typing and navigation latency.
Solution
Track TextEditingValue and verify whether text actually changed vs selection/cursor changes.
Avoid full-document string comparison when text identity or selection-only changes occur.
Benefits
0 string scanning overhead during arrow key navigation and cursor selection in large documents.
Smooth, instant cursor movements in heavy SQL scripts.
Closing: already handled. QueryaCodeEditor._onTextChanged starts with if (identical(currentText, _lastText)) return;. A caret move or selection change keeps the controller's text as the same String object (only selection changes in the new TextEditingValue), so it returns there without scanning the document. The full == runs only when the text object changed and has the same length, i.e. an actual edit that replaced characters, and then it stops at the first difference.
Activity
ZhuchkaTriplesix commentedon Oct 17, 2026
Closing: already handled.
QueryaCodeEditor._onTextChangedstarts withif (identical(currentText, _lastText)) return;. A caret move or selection change keeps the controller's text as the sameStringobject (onlyselectionchanges in the newTextEditingValue), so it returns there without scanning the document. The full==runs only when the text object changed and has the same length, i.e. an actual edit that replaced characters, and then it stops at the first difference.