insertText method
Inserts text at the specified line and character position.
line is zero-based (0 for the first line).
character is zero-based column position within the line.
The character position will be clamped to the line's length.
Implementation
void insertText(String text, int line, int character) {
if (readOnly) return;
_flushBuffer();
final clampedLine = line.clamp(0, lineCount - 1);
final lineText = getLineText(clampedLine);
final clampedChar = character.clamp(0, lineText.length);
final offset = getLineStartOffset(clampedLine) + clampedChar;
replaceRange(offset, offset, text);
}