deal with max=0 in the storer

This commit is contained in:
yory8 2019-10-27 13:59:04 +01:00
parent 2633e11f53
commit 24d13eb5bc

View file

@ -23,7 +23,8 @@ func store(text string, history []string, histfile string, max int, persist bool
}
// drop oldest items that exceed max list size
if l >= max {
// if max = 0, we allow infinite history; NOTE: users should NOT rely on this behaviour as we might change it without notice
if max != 0 && l >= max {
// usually just one item, but more if we suddenly reduce our --max-items
history = history[l-max+1:]
}