input: fix cursor's jump to end of input when user edit text at the middle of input