On Mon, Nov 27, 2017 at 8:47 AM, <lars.schneider@xxxxxxxxxxxx> wrote: > When a graphical GIT_EDITOR is spawned by a Git command that opens > and waits for user input (e.g. "git rebase -i"), then the editor window > might be obscured by other windows. The user may be left staring at the > original Git terminal window without even realizing that s/he needs to > interact with another window before Git can proceed. To this user Git > appears hanging. > > Show a message in the original terminal and get rid of it when the > editor returns. > > Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> > Signed-off-by: Lars Schneider <larsxschneider@xxxxxxxxx> > --- > diff --git a/editor.c b/editor.c > @@ -40,6 +40,35 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en > + static const char *close_notice = NULL; > + > + if (isatty(2) && !close_notice) { > + char *term = getenv("TERM"); > + > + if (term && strcmp(term, "dumb")) > + /* > + * go back to the beginning and erase the > + * entire line if the terminal is capable > + * to do so, to avoid wasting the vertical > + * space. > + */ > + close_notice = "\r\033[K"; > + else if (term && strstr(term, "emacsclient")) You need to check 'editor' here, not 'term', and you should do it before the "not dumb" terminal check, otherwise you'll never get this far. > + /* > + * `emacsclient` (or `emacsclientw` on Windows) already prints > + * ("Waiting for Emacs...") if a file is opened for editing. > + * Therefore, we don't need to print the editor launch info. > + */ > + ; > + else > + /* otherwise, complete and waste the line */ > + close_notice = _("done.\n"); > + }