git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Lars Schneider <larsxschneider@gmail.com>
Cc: git <git@vger.kernel.org>
Subject: Re: [RFC] Indicate that Git waits for user input via editor
Date: Thu, 16 Nov 2017 07:32:12 +0900	[thread overview]
Message-ID: <xmqq8tf7yxzn.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <274B4850-2EB7-4BFA-A42C-25A573254969@gmail.com> (Lars Schneider's message of "Wed, 15 Nov 2017 16:08:23 +0100")

Lars Schneider <larsxschneider@gmail.com> writes:

> However, if you configure an editor that runs outside your terminal window then
> you might run into the following problem: 
> Git opens the editor but the editor is the background or on another screen and 
> consequently you don't see the editor. You only see the Git command line 
> interface which appears to hang.
>
> I wonder if would make sense to print "Opening editor for user input..." or
> something to the screen to make the user aware of the action. Does this sound
> sensible to you? Am I missing an existing solution to this problem?

My knee-jerk reaction was: for such a user who has EDITOR set to a
program that pops under, wouldn't any program, not just Git, that
uses the editor to open a file for editing/viewing look broken?
Would we care if we are called "broken" by such a clueless user who
cannot tell a (non-)broken caller of an editor and a broken editor?

But that is true only when the user does realize/expect that the
program s/he is running _will_ open an editor at the point of the
workflow.  If s/he types "git merge" or "git rebase -i @{u}", for
example, it is true that the world would be a better place if s/he
knows that would ask a file to be edited with an editor, but it is
unrealisic to expect that everybody knows how to operate these
commands.  Everybody is a newbie at least once.

I wonder if we can do something like

	git_spawn_editor()
	{
		const char *EL = "\033[K"; /* Erase in Line */

		/* notice the lack of terminating LF */
		fprintf(stderr, "Launching your editor...");
		fflush(stderr);

		if (!run_command(... spawn the editor ...)) {
			/* Success! - go back and erase the whole line */
			fprintf(stderr, "\r%s", EL);
		} else {
			fprintf(stderr, "failed (%s)\n", strerror(errno));
		}
		fflush(stderr);
	}

to tentatively give a message without permanently wasting the
vertical space.

  parent reply	other threads:[~2017-11-15 22:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 15:08 [RFC] Indicate that Git waits for user input via editor Lars Schneider
2017-11-15 17:51 ` Stefan Beller
2017-11-15 18:07   ` Lars Schneider
2017-11-15 18:37     ` Stefan Beller
2017-11-15 22:32 ` Junio C Hamano [this message]
2017-11-16  0:06   ` Stefan Beller
2017-11-16  0:33     ` Junio C Hamano
2017-11-16  0:37       ` Stefan Beller
2017-11-16  5:37   ` Junio C Hamano
2017-11-16  6:04 ` [PATCH] launch_editor(): indicate that Git waits for user input Junio C Hamano
2017-11-16 10:25   ` Lars Schneider
2017-11-16 14:58     ` Junio C Hamano
2017-11-16 15:24       ` Lars Schneider
2017-11-17  1:09         ` Junio C Hamano
2017-11-18 17:47   ` Kaartic Sivaraam
2017-11-19  1:07     ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq8tf7yxzn.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=larsxschneider@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).