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 11:19 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> On 3/13/23, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > Question for the audience is whether we want to consider this a bug
> > and make it possible to use run-help as a standalone function.
>
> It could/should at least output some diagnostic, because it is very
> easy for an end-user (or very confused developer) to do this:
> % git<invoke run-help>
> % git<now press page up and enter which changes this line to:>
> % run-help git
> git is /usr/bin/git
> run-help:shift:106: shift count must be <= $#

A reasonable point.

> Looking at the code for processcmd it seems to literally only insert
> the string "run-help git" on the command line, so what exactly is this
> preliminary setup? I can't find it.

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.




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