cleanup
fix caret positioning