From 0cad0e7e668eb4a085e1da9bf4dfbb29a2b5b41c Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Sat, 26 Mar 2022 18:24:49 -0400 Subject: [PATCH] fix: only try to run hinter function if it isnt nil --- rl.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rl.go b/rl.go index ca4edab..3956f76 100644 --- a/rl.go +++ b/rl.go @@ -13,7 +13,7 @@ type lineReader struct { rl *readline.Instance } var fileHist *fileHistory -var hinter lua.LValue +var hinter lua.LValue = lua.LNil // other gophers might hate this naming but this is local, shut up func newLineReader(prompt string, noHist bool) *lineReader { @@ -46,6 +46,10 @@ func newLineReader(prompt string, noHist bool) *lineReader { hooks.Em.Emit("hilbish.vimAction", actionStr, args) } rl.HintText = func(line []rune, pos int) []rune { + if hinter == lua.LNil { + return []rune{} + } + err := l.CallByParam(lua.P{ Fn: hinter, NRet: 1,