From: Eric Sunshine <sunshine@sunshineco.com>
To: Lars Schneider <lars.schneider@autodesk.com>
Cc: Git List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Stefan Beller <sbeller@google.com>,
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>,
Lars Schneider <larsxschneider@gmail.com>
Subject: Re: [PATCH v3] launch_editor(): indicate that Git waits for user input
Date: Mon, 27 Nov 2017 13:36:00 -0500 [thread overview]
Message-ID: <CAPig+cSStSbckFi5K33z0WZThjNZC5Eb1Fb+ikrd5ZajM6mV3Q@mail.gmail.com> (raw)
In-Reply-To: <20171127134716.69471-1-lars.schneider@autodesk.com>
On Mon, Nov 27, 2017 at 8:47 AM, <lars.schneider@autodesk.com> 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@pobox.com>
> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
> ---
> 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");
> + }
next prev parent reply other threads:[~2017-11-27 18:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-27 13:47 [PATCH v3] launch_editor(): indicate that Git waits for user input lars.schneider
2017-11-27 17:17 ` Kaartic Sivaraam
2017-11-27 18:36 ` Eric Sunshine [this message]
2017-11-27 20:04 ` Lars Schneider
2017-11-27 20:09 ` brian m. carlson
2017-11-27 23:05 ` Jeff King
2017-11-28 4:29 ` Junio C Hamano
2017-11-28 12:31 ` Lars Schneider
2017-11-29 2:06 ` brian m. carlson
2017-11-27 23:18 ` Junio C Hamano
2017-11-28 12:39 ` Lars Schneider
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=CAPig+cSStSbckFi5K33z0WZThjNZC5Eb1Fb+ikrd5ZajM6mV3Q@mail.gmail.com \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kaartic.sivaraam@gmail.com \
--cc=lars.schneider@autodesk.com \
--cc=larsxschneider@gmail.com \
--cc=sbeller@google.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;
as well as URLs for NNTP newsgroup(s).