From 7bffac6caf879c1c7a7087528320972d425e06a5 Mon Sep 17 00:00:00 2001 From: yory8 <> Date: Sat, 21 Sep 2019 09:52:15 +0200 Subject: [PATCH] fix: avoid endless loop --- storer.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/storer.go b/storer.go index fc294be..851d1d3 100644 --- a/storer.go +++ b/storer.go @@ -15,6 +15,13 @@ func store(text string, history []string, histfile string, max int, persist bool l := len(history) if l > 0 { + // this avoids entering an endless loop, + // see https://github.com/bugaevc/wl-clipboard/issues/65 + last := history[l-1] + if text == last { + return nil + } + // drop oldest items that exceed max list size if l >= max { // usually just one item, but more if we suddenly reduce our --max-items