From 625f83e53511ed609ad9d5639cb3732a3c556883 Mon Sep 17 00:00:00 2001 From: Imbris Date: Mon, 2 Sep 2019 01:07:16 -0400 Subject: [PATCH] Don't add adjacent duplicates to the history --- voxygen/src/hud/chat.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/voxygen/src/hud/chat.rs b/voxygen/src/hud/chat.rs index 1aa82bab4a..82de74380f 100644 --- a/voxygen/src/hud/chat.rs +++ b/voxygen/src/hud/chat.rs @@ -310,9 +310,12 @@ impl<'a> Widget for Chat<'a> { state.update(|s| { s.input.clear(); // Update the history - s.history.push_front(msg.clone()); + // Don't add if this is identical to the last message in the history s.history_pos = 0; - s.history.truncate(self.history_max); + if s.history.get(0).map_or(true, |h| h != &msg) { + s.history.push_front(msg.clone()); + s.history.truncate(self.history_max); + } }); Some(Event::SendMessage(msg)) } else {