Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to fix run-help-* functions?
- X-seq: zsh-workers 51572
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>, Michele Venturi <dardo82@xxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: How to fix run-help-* functions?
- Date: Mon, 13 Mar 2023 13:41:04 -0700
- Archived-at: <https://zsh.org/workers/51572>
- In-reply-to: <CAH+w=7YL4_q5YHxC5GmuqaP1nNhUpmP7BKsxu==B-TpLB9zciA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CA+Ds4NvZ1uQhgfZChLWAT2_QjTjMzZfujFXDLAfmAR8=z3gv6g@mail.gmail.com> <CAH+w=7a=-==MoeLJLUVLvkedvO=qi-jTU3G2uLasivQhZZU78Q@mail.gmail.com> <1454747193.3405418.1678210315384@mail.virginmedia.com> <CAH+w=7YVtW=YmMiB60mssvYskitkxruFQVE3ai3g5KvPesN7ZQ@mail.gmail.com> <CA+Ds4NtzgeBtHGo9fdXFLc0xFzQM8WfFxoKr6R7OEkT5Y=qV7g@mail.gmail.com> <CAH+w=7Zf8S_eCgvYjTV3sp5h8ApXwy9SduMKViBe+hha0_OZHg@mail.gmail.com> <CAHYJk3R4T82A_SYQfqhmd+h8EN6QwCmPmTjMUSZZ4x-LkEzcMw@mail.gmail.com> <CAH+w=7YL4_q5YHxC5GmuqaP1nNhUpmP7BKsxu==B-TpLB9zciA@mail.gmail.com>
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