Git development
 help / color / mirror / 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 14:37:23 +0900	[thread overview]
Message-ID: <xmqq375ewzqk.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqq8tf7yxzn.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Thu, 16 Nov 2017 07:32:12 +0900")

Junio C Hamano <gitster@pobox.com> writes:

> I wonder if we can do something like
> ...
> to tentatively give a message without permanently wasting the
> vertical space.

Learning from 13e4760a ("recv_sideband: Do not use ANSI escape
sequence on dumb terminals.", 2008-01-08), I think the above should
be more like this:

	git_spawn_editor()
	{
		static const char *finish;

		if (!finish) {
			const char ANSI_FINISH[] = "\r\033[K";
			const char DUMB_FINISH[] = "done.\n";
			char *term = getenv("TERM");

			if (term && strcmp(term, "dumb"))
				finish = ANSI_FINISH;
			else
				finish = DUMB_FINISH;
		}

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

		if (!run_command(... spawn the editor ...))
			fputs(finish, stderr);
		else
			fprintf(stderr, "failed (%s)\n", strerror(errno));
		fflush(stderr);
	}

  parent reply	other threads:[~2017-11-16  5:37 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
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 [this message]
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

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

  git send-email \
    --in-reply-to=xmqq375ewzqk.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox