From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16628 invoked from network); 20 Jul 2004 16:13:11 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 20 Jul 2004 16:13:11 -0000 Received: (qmail 31047 invoked from network); 20 Jul 2004 16:13:05 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 20 Jul 2004 16:13:05 -0000 Received: (qmail 8271 invoked by alias); 20 Jul 2004 16:12:20 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7717 Received: (qmail 8261 invoked from network); 20 Jul 2004 16:12:20 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 20 Jul 2004 16:12:20 -0000 Received: (qmail 29274 invoked from network); 20 Jul 2004 16:10:21 -0000 Received: from unknown (HELO moonbase.zanshin.com) (167.160.213.139) by a.mx.sunsite.dk with SMTP; 20 Jul 2004 16:10:18 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.12.11/8.12.11) with ESMTP id i6KGAFDp020611 for ; Tue, 20 Jul 2004 09:10:15 -0700 Date: Tue, 20 Jul 2004 09:10:15 -0700 (PDT) From: Bart Schaefer Reply-To: zsh-users@sunsite.dk To: zsh-users@sunsite.dk Subject: Re: coloring STDERR to terminal In-Reply-To: <20040720045514.V326@willy_wonka> Message-ID: References: <20040627190433.Q27888@willy_wonka> <20040629160826.GL2033@ay.vinc17.org> <20040630070902.GO2033@ay.vinc17.org> <20040630114341.GR2033@ay.vinc17.org> <20040701181459.GF2033@ay.vinc17.org> <20040702124259.GS2033@ay.vinc17.org> <20040720045514.V326@willy_wonka> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 On Tue, 20 Jul 2004, Atom 'Smasher' wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > as i suspected, there doesn't seem to be a really good way to do this... > although there are several ways to ~almost~ do it well. > > that said, i'd like to request a feature for coloring STDERR. Your first sentence is quite literally true, which makes your feature request a little pointless. It doesn't matter by whom [*] the coloring is done; all the problems so far discussed are still present, with the possible exception of zsh being able to avoid printing a prompt in the middle of the error output. Even if you were to create a single process that could monitor both the stdout and stderr of every command run by zsh, and properly merge those streams so that the colors look right on the terminal, you can't avoid the issue that the stdio library changes its internal buffering behavior when the output file descriptors are not connected to TTY devices; so you'd have to use pseudo-TTYs instead of simple pipes. Even that is still subject to race conditions that can't be guaranteed to resolve the way they would if the two streams were going directly to the same TTY. On top of that, you need a scheme for dealing with interactive programs (or anything that does screen redraws involving cursor movement) such as text editors, that need their own direct and unmunged access to the actual terminal device. You'd have to create some sort of registry for them, like the "needsterminal" attribute in mailcap files, and deal with the headache of keeping that up to date for every new progam. The cumulative complexity of implementation is not worth the benefit. [*] If the kernel drivers could do it between the process output and the terminal display, you might get something close to what you want, but in that case you're on the wrong mailing list. > maybe a STDIN_COL and STDOUT_COL could also be handy? You don't really mean "stdin color" you mean "the ZLE editor buffer is a different color than the ZLE prompts." I hope. Otherwise you're asking for another process between the terminal and the input of every command, which process subsumes the role of the terminal driver in echoing back the characters typed. There are programs that do this (run zsh in an emacs buffer, for example) but they have their own set of quirks. For the ZLE buffer, you can color that with some careful settings of the various prompt variables.