2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-02 03:33:22 +00:00

fix: only try to run hinter function if it isnt nil

This commit is contained in:
TorchedSammy 2022-03-26 18:24:49 -04:00
parent 6ea25a22b3
commit 0cad0e7e66
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD

6
rl.go
View File

@ -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,