mirror of https://github.com/Hilbis/Hilbish
fix: prevent writing empty line to history
parent
f26ef935dd
commit
92f279e5cf
|
@ -38,6 +38,10 @@ func newFileHistory() (*fileHistory, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *fileHistory) Write(line string) (int, error) {
|
func (h *fileHistory) Write(line string) (int, error) {
|
||||||
|
if line == "" {
|
||||||
|
return len(h.items), nil
|
||||||
|
}
|
||||||
|
|
||||||
_, err := h.f.WriteString(line + "\n")
|
_, err := h.f.WriteString(line + "\n")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|
Loading…
Reference in New Issue