Re: [RFC] Indicate that Git waits for user input via editor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> 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);
	}



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux