Fix caret positioning issues.