mirror of
https://github.com/git/git
synced 2024-11-04 16:17:49 +00:00
launch_editor: waiting message on error
When advice.waitingForEditor configuration is not set to false, we show a hint telling that we are waiting for user's editor to close the file when we launch an editor and wait for it to return control back to us. We give the message on an incomplete line, expecting that we can go back to the beginning of the line and clear the message when the editor returns. However, it is possible that the editor exits with an error status, in which case we show an error message and then return to our caller. In such a case, the error message is given where the terminal cursor happens to be, which is most likely after the "we are waiting for your editor" message on the same line. Clear the line before showing the error. While we're here, make the error message follow our CodingGuideLines. Signed-off-by: Rubén Justo <rjusto@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
3c2a3fdc38
commit
48e1ca27b1
1 changed files with 3 additions and 4 deletions
7
editor.c
7
editor.c
|
@ -104,16 +104,15 @@ static int launch_specified_editor(const char *editor, const char *path,
|
||||||
sigchain_pop(SIGQUIT);
|
sigchain_pop(SIGQUIT);
|
||||||
if (sig == SIGINT || sig == SIGQUIT)
|
if (sig == SIGINT || sig == SIGQUIT)
|
||||||
raise(sig);
|
raise(sig);
|
||||||
if (ret)
|
|
||||||
return error("There was a problem with the editor '%s'.",
|
|
||||||
editor);
|
|
||||||
|
|
||||||
if (print_waiting_for_editor && !is_terminal_dumb())
|
if (print_waiting_for_editor && !is_terminal_dumb())
|
||||||
/*
|
/*
|
||||||
* Erase the entire line to avoid wasting the
|
* Erase the entire line to avoid wasting the
|
||||||
* vertical space.
|
* vertical space.
|
||||||
*/
|
*/
|
||||||
term_clear_line();
|
term_clear_line();
|
||||||
|
if (ret)
|
||||||
|
return error("there was a problem with the editor '%s'",
|
||||||
|
editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
|
|
Loading…
Reference in a new issue