diff --git a/history.go b/history.go index 2fcec56f..b666515c 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 6c684281..659e740b 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 - }