fixed bug with the right arrow button causing cursor to go to newline after clear