Re: [RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 30, 2018 at 12:26:40PM +0200, Martin Ågren wrote:

> >>> So perhaps:
> >>>
> >>>   void report_lines(FILE *out,
> >>>                     const char *color, const char *color_reset,
> >>>                  const char *prefix, const char *msg);
> >>>
> >>> or something?
> >>
> >> Sounds good to me.  And if you hate the repeated "error:" prefix
> >> that makes the prefix on the second and subsequent lines included in
> >> cutting and pasting, we could use the two-prefix idea elsewhere in
> >> the thread, too.
> 
> (That also gets rid of the minor strangeness of my series to introduce an
> overly broad `suffix` and use it only for resetting color, not actually
> for giving any textual suffix.)

Yeah, that "suffix" argument left me scratching my head at first. :)

> Somehow it feels slightly cleaner to me, at least on first thought, to
> try to decouple the indenting from the translating and line-wrapping.
> But as noted above, the indenting does affect how the line-wrapping
> should/may be done.

Yeah, agreed. Once report_lines() (or whatever we call it) knows what
the prefix is, it is capable of handling indentation on its own either
by repeating the prefix or by computing its visual width and outputting
appropriate spaces (which we can probably never get perfect without
knowing about the terminal, but we could at least make an approximation,
or even use some ANSI magic -- we could even make it run-time
configurable, though I'm not sure anybody would care that much).

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux