[RFC] ColorD

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Oct 26 10:02:05 PDT 2012


On Fri, Oct 26, 2012 at 04:46:26PM +0200, Jens Mueller wrote:
> H. S. Teoh wrote:
> > On Fri, Oct 26, 2012 at 08:08:36AM +0200, Robik wrote:
> > > On Friday, 26 October 2012 at 01:35:43 UTC, Adam D. Ruppe wrote:
[...]
> > > >writefln("\033]0;%s\007", title);
> > > >
> > > 
> > > Yeah, the problem is it does not work in all terminals.
> > 
> > The correct solution is to examine the TERM environment variable to
> > find out what kind of terminal it is, and then use escape sequences
> > specific to that terminal.
> 
> Or use a library that does this? There is terminfo. Don't know whether
> this is supported on all Posix platforms.
> I think the terminal's capabilities are stored in some files on the
> system.
[...]

Well, if you're going to use a library, terminfo is the way to go. All
modern Posix systems should have it. As for terminal description files,
don't rely on that, because it varies wildly from system to system. Your
best bet is to either recognize known values of $TERM, or use a library
like terminfo that takes care of all the dirty details for you. It does
get very messy once you get down to the nitty gritty of how different
*nixes handle terminal capabilities.


T

-- 
People tell me that I'm paranoid, but they're just out to get me.


More information about the Digitalmars-d mailing list