feat: make history clear function work again

pull/128/head
TorchedSammy 2022-03-22 19:01:29 -04:00
parent 7272e035d9
commit 1d4c8a7645
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 7 additions and 1 deletions

View File

@ -78,3 +78,9 @@ func (h *fileHistory) Len() int {
func (h *fileHistory) Dump() interface{} { func (h *fileHistory) Dump() interface{} {
return h.items return h.items
} }
func (h *fileHistory) clear() {
h.items = []string{}
h.f.Truncate(0)
h.f.Sync()
}

2
rl.go
View File

@ -271,6 +271,6 @@ func (lr *lineReader) luaAllHistory(L *lua.LState) int {
} }
func (lr *lineReader) luaClearHistory(l *lua.LState) int { func (lr *lineReader) luaClearHistory(l *lua.LState) int {
fileHist.clear()
return 0 return 0
} }