Handle adding items to the history repeatedly
Preserve whitespaces in commands when adding them to the history