append method
Appends new LaTeX content (fast path)
Uses TextEdit.fromAppend() to directly construct the edit description, skipping O(n) diff comparison. Text concatenation is done directly on IncrementalTokenizer's StringBuffer, avoiding O(n) string copies.
Implementation
void append(String text) {
if (text.isEmpty) return;
final oldLength = _tokenizer.getTextLength();
// Append directly on the tokenizer's StringBuffer to avoid toString() + concatenation
final newLength = _tokenizer.appendText(text);
final newText = _tokenizer.getCurrentText();
final edit = TextEdit.fromAppend(oldLength, newLength);
// HLog.d(_tag, "追加内容: '$text', 新长度: $newLength");
_applyEdit(oldLength, newText, edit);
}