From 483e5f6dbec7d32d7b75634732d82d056e0f1845 Mon Sep 17 00:00:00 2001 From: sammyette Date: Sat, 30 Sep 2023 19:52:33 -0400 Subject: [PATCH] fix(hilbish.completions): return prefix on the `call` function (from #263) --- CHANGELOG.md | 3 +++ complete.go | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48722dc..9cdcf11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ completed. - Example: `hilbish.alias('hello', 'echo %1 says hello')` allows the user to run `hello hilbish` which will output `hilbish says hello`. +### Fixed +- Return the prefix when calling `hilbish.completions.call` + [#219]: https://github.com/Rosettea/Hilbish/issues/219 ### Fixed - Replaced `sed` in-place editing with `grep` and `mv` for compatibility with BSD utils diff --git a/complete.go b/complete.go index 51b426f..0c70e07 100644 --- a/complete.go +++ b/complete.go @@ -253,15 +253,16 @@ func callLuaCompleter(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { } // we must keep the holy 80 cols - completerReturn, err := rt.Call1(l.MainThread(), - rt.FunctionValue(completecb), rt.StringValue(query), - rt.StringValue(ctx), rt.TableValue(fields)) + cont := c.Next() + err = rt.Call(l.MainThread(), rt.FunctionValue(completecb), + []rt.Value{rt.StringValue(query), rt.StringValue(ctx), rt.TableValue(fields)}, + cont) if err != nil { return nil, err } - return c.PushingNext1(t.Runtime, completerReturn), nil + return cont, nil } // #interface completions