Optimization for single-line text editing