diff --git a/history.go b/history.go index 2fcec56..b666515 100644 --- a/history.go +++ b/history.go @@ -78,3 +78,9 @@ func (h *fileHistory) Len() int { func (h *fileHistory) Dump() interface{} { return h.items } + +func (h *fileHistory) clear() { + h.items = []string{} + h.f.Truncate(0) + h.f.Sync() +} diff --git a/rl.go b/rl.go index 6c68428..659e740 100644 --- a/rl.go +++ b/rl.go @@ -271,6 +271,6 @@ func (lr *lineReader) luaAllHistory(L *lua.LState) int { } func (lr *lineReader) luaClearHistory(l *lua.LState) int { + fileHist.clear() return 0 - }