git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v5 2/2] launch_editor(): indicate that Git waits for user input

From
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Date
Dec 7, 2017, 17:37 UTC
Message-ID
<dfb2cde5-a499-8da3-9695-8c8fd46a96ad@gmail.com>
In-Reply-To
<xmqqmv2uec0p.fsf@gitster.mtv.corp.google.com>
On Thursday 07 December 2017 10:00 PM, Junio C Hamano wrote:
Show 6 quoted lines
> +
> +		if (print_waiting_for_editor) {
> +			/*
> +			 * A dumb terminal cannot erase the line later on. Add a
> +			 * newline to separate the hint from subsequent output.
> +			 *
> +			 * In case the editor emits further cruft after what
> +			 * we wrote above, separate it from our message with SP.

I guess this part of the comment could be improved a little. I currently interpret it as "See if the editor emits further cruft, print a space in that case". Though, it's not what we are doing. Something like the following, perhaps?

      In a non-dumb terminal, separate our message from further cruft
      that might be emitted by the editor with SP.
Show 26 quoted lines
> +			 */
> +			const char term = is_terminal_dumb() ? '\n' : ' ';
> +
> +			fprintf(stderr,
> +				_("hint: Waiting for your editor to close the file...%c"),
> +				term);
> +			fflush(stderr);
> +		}
>   
>   		p.argv = args;
>   		p.env = env;
> @@ -63,6 +80,13 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en
>   		if (ret)
>   			return error("There was a problem with the editor '%s'.",
>   					editor);
> +
> +		if (print_waiting_for_editor && !is_terminal_dumb())
> +			/*
> +			 * Go back to the beginning and erase the entire line to
> +			 * avoid wasting the vertical space.
> +			 */
> +			fputs("\r\033[K", stderr);
>   	}
>   
>   	if (!buffer)
> 
Previous: Lars SchneiderNext: Lars Schneider
Message 9 of 10 in “launch_editor(): indicate that Git waits for user input”
  1. 0/2 launch_editor(): indicate that Git waits for user inputlars.schneider@autodesk.com, Dec 7, 2017
  2. 1/2 refactor "dumb" terminal determinationlars.schneider@autodesk.com, Dec 7, 2017
  3. 2/2 launch_editor(): indicate that Git waits for user inputlars.schneider@autodesk.com, Dec 7, 2017
  4. Junio C HamanoDec 7, 2017
  5. Lars SchneiderDec 7, 2017
  6. Lars SchneiderDec 7, 2017
  7. Junio C HamanoDec 7, 2017
  8. Lars SchneiderDec 7, 2017
  9. Kaartic SivaraamDec 7, 2017
  10. Lars SchneiderDec 7, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.