fix: dont add last empty line of history, make sure first isnt missing in search

windows-fixes
TorchedSammy 2022-03-05 08:28:34 -04:00
parent 5175367b35
commit 88fd6f01b9
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 7 additions and 2 deletions

View File

@ -20,8 +20,13 @@ func newFileHistory() (*fileHistory, error) {
}
}
var itms []string
for _, l := range strings.Split(string(data), "\n") {
itms := []string{""}
lines := strings.Split(string(data), "\n")
for i, l := range lines {
if i == len(lines) - 1 {
println(i, l)
continue
}
itms = append(itms, l)
}
f, err := os.OpenFile(defaultHistPath, os.O_RDWR | os.O_CREATE, 0755)