Extract disable_history() from resize_history()
Fix segfault after decreasing 'history'

Happened on adding new elements to command-line history.
There was also double free error related to view history.

Thanks to Oleg Gordienko (a.k.a. gordio).
Merge branch 'fix-history-segfault'