Subject: Re: [PATCH v3 2/3] add-patch: Allow interfile navigation when selecting hunks

From: Junio C Hamano <[email-masked]>
Date: Thu, 12 Feb 2026 09:25:08 -0800

Samuel Abraham <[email-masked]> writes:

> On Fri, Feb 6, 2026 at 8:21 PM Junio C Hamano <[email-masked]> wrote:
>>
>> Abraham Samuel Adekunle <[email-masked]> writes:
>>
>> > @@ -1566,11 +1589,14 @@ static int patch_update_file(struct add_p_state *s,
>> >                                               : 1));
>> >               printf(_(s->mode->prompt_mode[prompt_mode_type]),
>> >                      s->buf.buf);
>> > +             if (s->s.no_auto_advance && all_decided)
>> > +                     printf(_("\n%s All hunks decided. What now? "),
>> > +                             s->s.prompt_color);
>>
>> This gives an ordinary prompt for the hunk and then another one
>> after it if we notice everything has been decided.  I am wondering
>> if it wants to be more like
>>
>>         if (!s->auto_advance && all_decided)
>>                 say What now?
>>         else
>>                 ask the usual
>>
>> ?
>
> Hello Junio
> Please just a small curiosity.
>
> If I do it this way, the user will not be able to see the options available
> once they have decided on all hunks and want to rework the file.
> The options for a hunk will not be visible if they navigate with say K or J
> and want to change decisions on a hunk.
> They will always be greeted with What now? without the available options.

Ah, OK.

But then after deciding on all hunks and not telling the prompt to
move to another file, the user will keep seeing this extra line of
prompt?

It somehow smells like a waste of a whole line just to remind the
user that all hunks in the file have now been decided.

There was a separate topic that added "(was: [yn])" to the prompt
when the prompt asks about a hunk that already has been decided on.
As we only need a single bit "all hunks decided", can we do
something similar, I wonder?  At the beginning of the main prompt,
we show which of the N available hunks we are currently at, e.g.,

 (1/2) Stage this hunk (was: y) [y,n,q,a,d,k,K,j,J,g,/,e,p,P,?]?

Perhaps we can add a third number to indicate how many of the
available hunks the user has already decided, or something, that can
be used to avoid this wasted line?  Or is it a good thing that we
are loud in this case using a whole line to remind the user that it
may be time to move on?  I dunno.

In any case, even though I am not 100% sure that this design to
devote an extra line for this single bit of information is the best
one, I now understand the need for conveying it.  Thanks.