Re: [PATCH v4 2/2] launch_editor(): indicate that Git waits for user input
- Date: Sat, 02 Dec 2017 21:15:29 -0800
- From: Junio C Hamano <gitster@xxxxxxxxx>
- Subject: Re: [PATCH v4 2/2] launch_editor(): indicate that Git waits for user input
Jeff King <peff@xxxxxxxx> writes:
> I tried to think of ways this "show a message and then delete it" could
> go wrong. It should work OK with editors that just do curses-like
> things, taking over the terminal and then restoring it at the end.
I think that it is not worth to special-case "dumb" terminals like
this round of the patches do. If it so much disturbs reviewers that
"\e[K" may not work everywhere, we can do without the "then delete
it" part. It was merely trying to be extra nice, and the more
important part of the "feature" is to be noticeable, and I do think
that not showing anything on "dumb", only because the message cannot
be retracted, is putting the cart before the horse.
Since especially now people are hiding this behind an advise.*
thing, I think it is OK to show a message and waste a line, even.
> An even worse case (and yes, this is really reaching) is:
> $ GIT_EDITOR='echo one; printf "two\\r"; vim' git commit
> hint: Waiting for your editor input...one
> Aborting commit due to empty commit message.
> There we ate the "two" line.
Yes, I would have to agree that this one is reaching, as there isn't
any valid reason other than "the editor then wanted to do \e[K
later" for it to end its last line with CR. So our eating that line
is not a problem.