mirror of https://github.com/Hilbis/Hilbish
fix: only try to run hinter function if it isnt nil
parent
6ea25a22b3
commit
0cad0e7e66
6
rl.go
6
rl.go
|
@ -13,7 +13,7 @@ type lineReader struct {
|
||||||
rl *readline.Instance
|
rl *readline.Instance
|
||||||
}
|
}
|
||||||
var fileHist *fileHistory
|
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
|
// other gophers might hate this naming but this is local, shut up
|
||||||
func newLineReader(prompt string, noHist bool) *lineReader {
|
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)
|
hooks.Em.Emit("hilbish.vimAction", actionStr, args)
|
||||||
}
|
}
|
||||||
rl.HintText = func(line []rune, pos int) []rune {
|
rl.HintText = func(line []rune, pos int) []rune {
|
||||||
|
if hinter == lua.LNil {
|
||||||
|
return []rune{}
|
||||||
|
}
|
||||||
|
|
||||||
err := l.CallByParam(lua.P{
|
err := l.CallByParam(lua.P{
|
||||||
Fn: hinter,
|
Fn: hinter,
|
||||||
NRet: 1,
|
NRet: 1,
|
||||||
|
|
Loading…
Reference in New Issue