Update the cursor position when manually setting the value of an input