Re: How do I turn ANSI-terminal colourising off?
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 08/15/2013 03:13 AM, Richard A. O'Keefe wrote:
> user:message_property(new_features, after('6.1'))).
>
> could do the job here?
>
> The big thing is that there are features that the user has to
> *choose* and there are features that are *forced* on the user
> and the user *must* be told at least once about the latter kind.
Is worth considering. Not really on my shortlist though. It
requires infrastructure to collect these messages, some form
of guidelines to structure them and maybe worst, a sensible
way to display them. In most applications that have these
things I quickly disable them. It is very easy to get wrong ...
> them into TextEdit gives me straight black and white. SWI Prolog
> colourised interactions also turn into black-and-white when
> copied and pasted into TextEdit. In both cases this applies
> regardless of whether TextEdit is in 'rich text' mode or not.
Complain with whoever wrote the terminal emulator.
> There's one thing still not clear to me about this feature.
>
> %user:message_property(informational, color(fg(green))).
> %user:message_property(information, color(fg(green))).
> %user:message_property(debug, color(fg(blue))).
> %user:message_property(warning, color(fg(red))).
> %user:message_property(error, color([fg(red),bold])).
>
> Colour Line
> black ?- [library(lists)].
Input lines don't go through the message systems and are thus
not coloured.
> green % library(pairs) compiled into pairs 0.00 sec, 22 clauses
> green % library(lists) compiled into lists 0.00 sec, 122 clauses
These are informational messages.
> purple true.
These are printed using print_message(query, query_result(Term)),
which is handled in boot/messages.pl. Some of the colouring there
is hard-wired. true. is printed in *bold*. If it is purple, there
is something wrong. I'd suspect your terminal emulator. At least,
it works fine in at least 4 different emulators I use. You can
define
prolog:message(query(QueryResult)) -->
...
to make it behave as you want. I don't think I have to explain how
that works :-)
> - What is the message_property that controls the colour of the prompt?
The prompt is not printed by print_message/2, but defined by prompt/2.
I guess you can put ANSI sequences in there. Not sure GNU readline's
position logic likes that.
> - Of the user's input?
See above.
> - Which is the property responsible for setting the purple line?
See above.
> Documentation is a lot like test cases. Writing it can uncover bugs.
Some things I rather leave undocumented. It's just a lot of work,
very few people really care and it makes changes much harder to
realise.
Cheers --- Jan