From 460c5080d00d0bdd6c8ffaca9086fd0ed6ac807d Mon Sep 17 00:00:00 2001 From: yory8 <> Date: Mon, 16 Sep 2019 20:38:39 +0200 Subject: [PATCH] fix: skip empty copy --- storer.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/storer.go b/storer.go index 238fe03..76c3ad2 100644 --- a/storer.go +++ b/storer.go @@ -7,11 +7,15 @@ import ( "os/exec" ) -func store(text string, history []string, histfile string, max int, persist bool) []string { +func store(text string, history []string, histfile string, max int, persist bool) { + if text == "" { + return + } + l := len(history) if l > 0 { if history[l-1] == text { - return history + return } if l >= max { @@ -38,7 +42,7 @@ func store(text string, history []string, histfile string, max int, persist bool } } - return history + return } func filter(history []string, text string) []string {