Improve the "input mode" so the cursor is correctly positioned