git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] launch_editor: waiting message on error
@ 2024-04-08 21:02 Rubén Justo
  2024-04-08 21:07 ` Rubén Justo
  0 siblings, 1 reply; 26+ messages in thread
From: Rubén Justo @ 2024-04-08 21:02 UTC (permalink / raw)
  To: Git List, Junio C Hamano

We have the hint we're touching in this commit since abfb04d0c7
(launch_editor(): indicate that Git waits for user input, 2017-12-07).

Adding a new line after the hint when the editor returns error was
discussed in the list, but finally it was considered not necessary
because a shorter message is used [1].

However, even with a short message, feeding that LF makes our next
"error: There was a problem with the..." more clear.  For example, the
editor could print messages that would be mixed with our error message.
So, add that LF.

While we're here, make the error message follow our CodingGuideLines.

 [1] https://public-inbox.org/git/20171127134716.69471-1-lars.schneider@autodesk.com/T/#u

Signed-off-by: Rubén Justo <rjusto@gmail.com>
---
 editor.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/editor.c b/editor.c
index b67b802ddf..a658090a65 100644
--- a/editor.c
+++ b/editor.c
@@ -104,16 +104,25 @@ static int launch_specified_editor(const char *editor, const char *path,
 		sigchain_pop(SIGQUIT);
 		if (sig == SIGINT || sig == SIGQUIT)
 			raise(sig);
-		if (ret)
-			return error("There was a problem with the editor '%s'.",
-					editor);
 
-		if (print_waiting_for_editor && !is_terminal_dumb())
-			/*
-			 * Erase the entire line to avoid wasting the
-			 * vertical space.
-			 */
-			term_clear_line();
+		if (print_waiting_for_editor && !is_terminal_dump())
+			if (!ret)
+				/*
+			 	 * Erase the entire line to avoid wasting
+			 	 * the vertical space.
+			 	 */
+				term_clear_line();
+			else
+				/*
+				 * We don't want term_clear_line() here
+				 * because the editor could have written
+				 * some useful messages to the user.
+				 */
+				fprintf(stderr, "\n");
+
+		if (ret) 
+			return error("there was a problem with the editor '%s'",
+					editor);
 	}
 
 	if (!buffer)
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2024-04-15 18:44 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-08 21:02 [PATCH] launch_editor: waiting message on error Rubén Justo
2024-04-08 21:07 ` Rubén Justo
2024-04-08 23:09   ` [PATCH v2] " Rubén Justo
2024-04-09  1:27     ` Junio C Hamano
2024-04-09 23:38       ` Rubén Justo
2024-04-10 15:44         ` Junio C Hamano
2024-04-11 23:18           ` Rubén Justo
2024-04-12 15:46             ` Junio C Hamano
2024-04-12 17:03               ` Rubén Justo
2024-04-12 17:35                 ` Junio C Hamano
2024-04-12 18:24                   ` Rubén Justo
2024-04-12 17:05     ` [PATCH v3 0/2] launch_editor: waiting message Rubén Justo
2024-04-12 17:15       ` [PATCH v3 1/2] launch_editor: waiting for editor message Rubén Justo
2024-04-12 17:24         ` rsbecker
2024-04-12 17:37           ` Rubén Justo
2024-04-12 17:47             ` rsbecker
2024-04-13 15:06           ` Phillip Wood
2024-04-12 17:15       ` [PATCH v3 2/2] launch_editor: waiting message on error Rubén Justo
2024-04-13 15:09         ` Phillip Wood
2024-04-14  7:23           ` Rubén Justo
2024-04-14  7:39       ` [PATCH v4] " Rubén Justo
2024-04-15 14:05         ` Phillip Wood
2024-04-15 17:03           ` Rubén Justo
2024-04-15 17:20           ` Junio C Hamano
2024-04-15 17:07         ` Rubén Justo
2024-04-15 18:44           ` Junio C Hamano

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).