From: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [Suggestion] Alternative way for displaying help menu of patch flow
Date: Fri, 28 Apr 2017 12:51:14 +0530 [thread overview]
Message-ID: <4d6eb11e-f102-7695-7f4a-562407ea13c0@gmail.com> (raw)
In-Reply-To: <20170428063723.2ni2v6akosm4ldvy@sigill.intra.peff.net>
On Friday 28 April 2017 12:07 PM, Jeff King wrote:
>
> If the hunk is big, that message scrolls off the screen. We could
> probably put it after the hunk, but I'd worry that the ordering would be
> confusing (because it comes between the hunk and the "this hunk" prompt.
Probably it could be better to clear the console after each user input,
before
the result of that input is displayed. That could probably remove the
clutter
and could allow the user to easily differentiate from the current output
from
previous output.
> Or it could just not re-display the hunk all (like what my patch does
> for help), and you'd get:
>
> @@ -1 +1 @@
> -old
> +new
> Stage this hunk [y,n,q,a,d,/,e,?]? j
> No next hunk
> Stage this hunk [y,n,q,a,d,/,e,?]?
>
> at which point you could "r" to redisplay it if you wanted to.
This seems good too. But, I guess, the help menu would probably hide the
hunk and could make that prompt a little absurd.
> I also suspect that other menus in add--interactive have the same
> issue. E.g., if you have a large number of files what does the
> file-selection menu "git add -i" look like? Perhaps the issue is less
> common there, though.
>
> ---
> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
> index 709a5f6ce..81f62331b 100755
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -1237,6 +1237,7 @@ k - leave this hunk undecided, see previous undecided hunk
> K - leave this hunk undecided, see previous hunk
> s - split the current hunk into smaller hunks
> e - manually edit the current hunk
> +r - redisplay the current hunk
> ? - print help
> EOF
> }
> @@ -1385,6 +1386,7 @@ my %patch_update_prompt_modes = (
> sub patch_update_file {
> my $quit = 0;
> my ($ix, $num);
> + my $skip_hunk_display;
> my $path = shift;
> my ($head, @hunk) = parse_diff($path);
> ($head, my $mode, my $deletion) = parse_diff_header($head);
> @@ -1451,8 +1453,13 @@ sub patch_update_file {
> if ($hunk[$ix]{TYPE} eq 'hunk') {
> $other .= ',e';
> }
> - for (@{$hunk[$ix]{DISPLAY}}) {
> - print;
> +
> + if ($skip_hunk_display) {
> + $skip_hunk_display = 0;
> + } else {
> + for (@{$hunk[$ix]{DISPLAY}}) {
> + print;
> + }
> }
> print colored $prompt_color,
> sprintf(__($patch_update_prompt_modes{$patch_mode}{$hunk[$ix]{TYPE}}), $other);
> @@ -1608,8 +1615,13 @@ sub patch_update_file {
> splice @hunk, $ix, 1, $newhunk;
> }
> }
> + elsif ($line =~ /^r/) {
> + # do nothing; we'll show the hunk when we loop
> + next;
> + }
> else {
> help_patch_cmd($other);
> + $skip_hunk_display = 1;
> next;
> }
> # soft increment
Regards,
Kaartic
prev parent reply other threads:[~2017-04-28 7:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-28 5:14 [Suggestion] Alternative way for displaying help menu of patch flow Kaartic Sivaraam
2017-04-28 6:37 ` Jeff King
2017-04-28 7:21 ` Kaartic Sivaraam [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4d6eb11e-f102-7695-7f4a-562407ea13c0@gmail.com \
--to=kaarticsivaraam91196@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).