fix(hilbish.completions): return prefix on the `call` function (from #263)

readline-lua-module
sammyette 2023-09-30 19:52:33 -04:00
parent 4fcd310048
commit 483e5f6dbe
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 8 additions and 4 deletions

View File

@ -16,6 +16,9 @@ completed.
- Example: `hilbish.alias('hello', 'echo %1 says hello')` allows the user to run `hello hilbish` - Example: `hilbish.alias('hello', 'echo %1 says hello')` allows the user to run `hello hilbish`
which will output `hilbish says hello`. which will output `hilbish says hello`.
### Fixed
- Return the prefix when calling `hilbish.completions.call`
[#219]: https://github.com/Rosettea/Hilbish/issues/219 [#219]: https://github.com/Rosettea/Hilbish/issues/219
### Fixed ### Fixed
- Replaced `sed` in-place editing with `grep` and `mv` for compatibility with BSD utils - Replaced `sed` in-place editing with `grep` and `mv` for compatibility with BSD utils

View File

@ -253,15 +253,16 @@ func callLuaCompleter(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
} }
// we must keep the holy 80 cols // we must keep the holy 80 cols
completerReturn, err := rt.Call1(l.MainThread(), cont := c.Next()
rt.FunctionValue(completecb), rt.StringValue(query), err = rt.Call(l.MainThread(), rt.FunctionValue(completecb),
rt.StringValue(ctx), rt.TableValue(fields)) []rt.Value{rt.StringValue(query), rt.StringValue(ctx), rt.TableValue(fields)},
cont)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return c.PushingNext1(t.Runtime, completerReturn), nil return cont, nil
} }
// #interface completions // #interface completions