[TextEditor] Optimized the avl tree a bit.