Improve readline history logic
doc test