diff --git a/src/promptbuffer.rs b/src/promptbuffer.rs index 3045f6a..31bdac8 100644 --- a/src/promptbuffer.rs +++ b/src/promptbuffer.rs @@ -40,6 +40,10 @@ impl PromptBuffer { self.buffer_changed = false; if s != "" { self.hist.push_back(s.clone()); } + while self.hist.len() > self.hist_maxlen { + self.hist.pop_front(); + } + return s; }