[TextEditor] Improved undo performance (Fixed 'Bug 17959 - Poor Undo
Performance').