fix: skip empty copy
This commit is contained in:
parent
c42e1cabf8
commit
460c5080d0
1 changed files with 7 additions and 3 deletions
10
storer.go
10
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 {
|
||||
|
|
Loading…
Reference in a new issue