Re: [PATCH v3 2/3] add-patch: Allow interfile navigation when selecting hunks
From: Samuel Abraham <hidden>
Date: 2026-02-12 21:13:38
On Thu, Feb 12, 2026 at 6:25 PM Junio C Hamano [off-list ref] wrote:
Samuel Abraham [off-list ref] writes:quoted
On Fri, Feb 6, 2026 at 8:21 PM Junio C Hamano [off-list ref] wrote:quoted
Abraham Samuel Adekunle [off-list ref] writes:quoted
@@ -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.
I thought of a suggestion where after deciding on all hunks in the file, the user will be able to see the "what now prompt", the options for the current hunk and also the previous decision on the hunk since at this point, all the hunks would have been decided on. I tried something like What now? (was: n) [y,n,q,a,d,s,e,>,<,p,P,?]? This does not show the number of the hunk we are currently at and the "Stage this hunk" since the decision had been made initially but the "whatnow" prompt still provides a chance to change the decision, while showing the previous decision on the hunk by asking "What now?" instead. The options have the default [y,n,q,a,d] and the remaining options are populated from the permit set for the hunk. SO the user can still carry out the normal actions on the hunk. In response to your earlier question, if the user decides on all hunks in a file and does not go to the next file, he'll see the prompt above and that is what will keep showing if he remains in the file, no extra line. If he navigates away, the hunk re-renders with the "what now" prompt when he comes back. If he had made all decisions in a file and decides to split a splittable hunk, then the normal prompt shows for those hunks since they are now undecided. What do you think about this? Thanks Abraham