history and cursor fix

Search on history improved
cursor position follow temporary fix
small other improvements