From 24d13eb5bcb32ed19de975f2cd588aeb0e7c0d71 Mon Sep 17 00:00:00 2001 From: yory8 <> Date: Sun, 27 Oct 2019 13:59:04 +0100 Subject: [PATCH] deal with max=0 in the storer --- storer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storer.go b/storer.go index 851d1d3..cb40d94 100644 --- a/storer.go +++ b/storer.go @@ -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:] }