update cursor but have bug on backspace.