Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to fix run-help-* functions?



On Mon, Mar 13, 2023 at 1:31 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> It does a push-line so that the run-help function can retrieve it with
> getln.  See workers/49218
>
> If there's no line pushed, the run-help function is going to push a
> blank one (with print -z) immediately after getln fails, so there's
> several things that need to (not) happen if the widget is not used.

This seems to cover it:

diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help
index d52c1b032..0bf84447a 100644
--- a/Functions/Misc/run-help
+++ b/Functions/Misc/run-help
@@ -98,9 +98,9 @@ do
            if whence "run-help-$1:t" >/dev/null
            then
                local cmd_args
-               builtin getln cmd_args
+               builtin getln cmd_args &&
                builtin print -z "$cmd_args"
-               cmd_args=( ${(z)cmd_args} )
+               cmd_args=( ${(z)${cmd_args:-"$*"}} )

                 # Discard the command itself & everything before it.
                 shift $cmd_args[(i)${run_help_orig_cmd:-$1}] cmd_args ||




Messages sorted by: Reverse Date, Date, Thread, Author