insertTemplate method
Insert a template and position the cursor at the template's placeholder
Implementation
void insertTemplate(LatexTemplate template) {
final expanded = template.expand();
final before = _text.substring(0, _cursorOffset);
final after = _text.substring(_cursorOffset);
_text = before + expanded.text + after;
_cursorOffset += expanded.cursorDelta;
_selection = null;
_reparse();
notifyListeners();
}