fix: skip empty copy

This commit is contained in:
yory8 2019-09-16 20:38:39 +02:00
parent c42e1cabf8
commit 460c5080d0

View file

@ -7,11 +7,15 @@ import (
"os/exec" "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) l := len(history)
if l > 0 { if l > 0 {
if history[l-1] == text { if history[l-1] == text {
return history return
} }
if l >= max { 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 { func filter(history []string, text string) []string {