Re: [PATCH/RFC] sideband: remove line padding (was: Re: [PATCH] progress: use \r as EOL only if isatty(stderr) is true)

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

 



@ Nicolas Pitre <nico@xxxxxxxxxxx> wrote (2011-06-29 20:15+0200):
> Why?

Ok, they don't.  (Your initial patch was from 2008, and since
git(1) is evolving very fast, it might have been that padding is
no longer of any use at all.)
So, then, i'm the right person to turn the big wheel:

- Move color.* and even progress.* stuff into new visual.[hc].
- Add a vis[ual]_init() which does check isatty() for [012] and
  does the TERM check (i.e. "dumb" or otherwise).
  There could also be flags which could be used to restrict what
  is checked ...
- Replace calls to isatty(xy) by std{in,out,err}_is_tty(), defined
  in visual.h.
  Calling vis[ual]_init() would not be needed for these.
  (But they could be inline if it would be.)
- Add a series of vis_print functions in equal spirit to the
  color series which use detected terminal capabilities to ensure
  that a line consists only of the printed data.

I (almost) had that state hour ago, but it's ...  (The problem with
that print series is that in the dumb case the data is to be injected
before a possibly contained NL/CR sequence, so that already inspected
data is to be reinspected.  Or data has to be copied around.  Or
writes have to be splitted, but here i'm talking about stderr, and
that's unbuffered, and so each invocation goes through the OS.)

So what else could be done to remove TERM and ANSI escape sequence
knowledge from a nice multiband stream splitter, and to avoid that
it writes the escape sequence if output is stupidly redirected to a
file?  Well, visual.h could consist of a single function only:

    const char *ansi_el_if_tty_and_termok_else_null(void);
--
Ciao, Steffen
sdaoden(*)(gmail.com)
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]