fix: avoid endless loop
This commit is contained in:
parent
f422626935
commit
7bffac6caf
1 changed files with 7 additions and 0 deletions
|
@ -15,6 +15,13 @@ func store(text string, history []string, histfile string, max int, persist bool
|
||||||
|
|
||||||
l := len(history)
|
l := len(history)
|
||||||
if l > 0 {
|
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
|
// drop oldest items that exceed max list size
|
||||||
if l >= max {
|
if l >= max {
|
||||||
// usually just one item, but more if we suddenly reduce our --max-items
|
// usually just one item, but more if we suddenly reduce our --max-items
|
||||||
|
|
Loading…
Reference in a new issue