From 70e40cb7ae4eda7431b37ff2f6bcb6ed67313d1d Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Sun, 18 Feb 2024 16:54:07 -0600 Subject: [PATCH] don't add empty text to history --- src/history.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/history.rs b/src/history.rs index 46905e0..21e8f28 100644 --- a/src/history.rs +++ b/src/history.rs @@ -8,7 +8,11 @@ impl History { } pub fn add>(&mut self, event: S) { - self.events.push(event.into()); + let text = event.into(); + if text.is_empty() { + return; + } + self.events.push(text); } pub fn look_back(&self, idx: usize) -> Option<&str> {