Re: [RFC PATCH 2/3] usage: prefix all lines in `vreportf()`, not just the first
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 28, 2018, 21:45 UTC
- Message-ID
- <xmqq8t83ihd7.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <CACsJy8CgzDfbES2jC+Rv+bKj_JAk8dzEDCm89JMuBFQmyGg9Gw@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 13 quoted lines
>>> +error: sub/added >>> +error: sub/addedtoo >>> +error: Please move or remove them before you switch branches. >>> Aborting >>> EOF >> >> This shows the typical effect of this series, which (I subjectively >> think) gives us a more pleasant end-user experience. > > Also, very subjectively, I'm torn about this. To me, just one > "error/warning/fatal" at the start of the first paragraph feels much > better. If we have to somehow mark the second paragraph that "this is > also part of the error message" then it's probably better to rephrase.
I personally can go either way. If you prefer less noisy route, we could change the function signature of vreportf() to take a prefix for the first line and another prefix for the remaining lines and pass that through down to the "split and print with prefix" helper.
That way, we can
- allow callers to align 1st prefix (e.g. "error: ") with the leading indent for the second and subsequent lines by passing the second prefix with appropriate display width.
- allow translators to grow or shrink number of lines a given message takes, and to decide where in the translated string to wrap lines.
Even though step 3/3 may become a bit awkward (the second prefix would most likely be only whitespace, and you'd need to write something silly like _("\t")), we can still keep the alignment if we wanted to.