mirror of https://github.com/Hilbis/Hilbish
Compare commits
1 Commits
229fe4c6bb
...
0a225ac847
Author | SHA1 | Date |
---|---|---|
James Dugan | 0a225ac847 |
11
api.go
11
api.go
|
@ -712,14 +712,5 @@ func hlhinter(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
||||||
// #example
|
// #example
|
||||||
// #param line string
|
// #param line string
|
||||||
func hlhighlighter(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
func hlhighlighter(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
||||||
if err := c.Check1Arg(); err != nil {
|
return c.Next(), nil
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
line, err := c.StringArg(0)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return c.PushingNext1(t.Runtime, rt.StringValue(line)), nil
|
|
||||||
}
|
}
|
||||||
|
|
13
rl.go
13
rl.go
|
@ -70,8 +70,11 @@ func newLineReader(prompt string, noHist bool) *lineReader {
|
||||||
hooks.Emit("hilbish.vimAction", actionStr, args)
|
hooks.Emit("hilbish.vimAction", actionStr, args)
|
||||||
}
|
}
|
||||||
rl.HintText = func(line []rune, pos int) []rune {
|
rl.HintText = func(line []rune, pos int) []rune {
|
||||||
hinter := hshMod.Get(rt.StringValue("hinter"))
|
if hinter == nil {
|
||||||
retVal, err := rt.Call1(l.MainThread(), hinter,
|
return []rune{}
|
||||||
|
}
|
||||||
|
|
||||||
|
retVal, err := rt.Call1(l.MainThread(), rt.FunctionValue(hinter),
|
||||||
rt.StringValue(string(line)), rt.IntValue(int64(pos)))
|
rt.StringValue(string(line)), rt.IntValue(int64(pos)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
@ -86,8 +89,10 @@ func newLineReader(prompt string, noHist bool) *lineReader {
|
||||||
return []rune(hintText)
|
return []rune(hintText)
|
||||||
}
|
}
|
||||||
rl.SyntaxHighlighter = func(line []rune) string {
|
rl.SyntaxHighlighter = func(line []rune) string {
|
||||||
highlighter := hshMod.Get(rt.StringValue("highlighter"))
|
if highlighter == nil {
|
||||||
retVal, err := rt.Call1(l.MainThread(), highlighter,
|
return string(line)
|
||||||
|
}
|
||||||
|
retVal, err := rt.Call1(l.MainThread(), rt.FunctionValue(highlighter),
|
||||||
rt.StringValue(string(line)))
|
rt.StringValue(string(line)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|
Loading…
Reference in New Issue