make a function __replace_typing

It's replacing typing and set cursor