On Sun, Apr 14, 2024 at 09:39:44AM +0200, Rubén Justo wrote: > 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 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@xxxxxxxxx> > --- The changes since v3 are: - dropped [v3 1/2] because, as noted by Randall and Phillip, it is not a good idea. The message stays like: $ GIT_EDITOR=falso git commit -a hint: Waiting for your editor to close the file... error: cannot run falso: No such file or directory error: unable to start editor 'falso' Please supply the message using either -m or -F option. The "error: unable to start..." at the beginning of the line makes it less prone to confusion than the other error message considered in this series. - term_clear_line() is now used in all cases as it is unlikely that any sane editor emits an error message without ending it with a newline. This: $ GIT_EDITOR=false git commit -a hint: Waiting for your editor to close the file... error: There was a problem with the editor 'false'. Please supply the message using either -m or -F option. becomes: $ GIT_EDITOR=false git commit -a error: There was a problem with the editor 'false'. Please supply the message using either -m or -F option.