From e7a5a474ef3f306f08656707d1c77cfb386557f0 Mon Sep 17 00:00:00 2001 From: c-bata Date: Fri, 4 Aug 2017 20:33:28 +0900 Subject: [PATCH] Fix history clear --- history.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/history.go b/history.go index f6885b2..d183713 100644 --- a/history.go +++ b/history.go @@ -10,12 +10,12 @@ type History struct { func (h *History) Add(input string) { h.histories = append(h.histories, input) - copy(h.tmp, h.histories) - h.tmp = append(h.tmp, "") - h.selected = len(h.tmp) - 1 + h.Clear() } func (h *History) Clear() { + copy(h.tmp, h.histories) + h.tmp = append(h.tmp, "") h.selected = len(h.tmp) - 1 }