Fix possible endless recursion in text editing events handling.