From 86dbbbb890aaa1e627912f8e1b056c8db79a9ff0 Mon Sep 17 00:00:00 2001 From: ThomasBreuer Date: Mon, 22 Feb 2021 11:57:26 +0100 Subject: [PATCH] adjust the documentation of `ColorPrompt` ... to the change of the default (see #4274), and make the function `ColorPrompt` readonly --- lib/colorprompt.g | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/colorprompt.g b/lib/colorprompt.g index 921dead04c..ad59674817 100644 --- a/lib/colorprompt.g +++ b/lib/colorprompt.g @@ -42,11 +42,14 @@ EndLineHook := function() end; ## ## ## -## With ColorPrompt(true); ⪆ changes its user interface: -## The prompts and the user input are displayed in different colors. -## Switch off the colored prompts with ColorPrompt(false);. +## changes ⪆'s user interface: +## After calling ColorPrompt(true);, +## the prompts and the user input are displayed in colors different from +## the color that is used for the output. +## This is also the default for a ⪆ session. +## Switch off these colorings with ColorPrompt(false);. ##

-## Note that this will only work if your terminal emulation in which +## Note that colors will only work if your terminal emulation in which ## you run ⪆ understands the so called ANSI color escape sequences ## –almost all terminal emulations on current UNIX/Linux ## (xterm, rxvt, konsole, ...) systems do so. @@ -56,8 +59,9 @@ EndLineHook := function() end; ## conventions you see the standard prompt in bold blue and the break ## loop prompt in bold red, as well as your input in red. ##

-## If it works for you and you like it, put a call of -## SetUserPreference("UseColorPrompt", true); +## If you prefer to switch off colors for prompts and input at the start +## of your &GAP; sessions, put a call of +## SetUserPreference("UseColorPrompt", false); ## in your gap.ini file. ## If you want a more complicated setting as explained below then ## put your SetUserPreference("UseColorPrompt", rec( ... ) ); @@ -125,7 +129,7 @@ EndLineHook := function() end; ## ## <#/GAPDoc> ## -ColorPrompt := function(arg) +BindGlobal( "ColorPrompt", function(arg) local b, r, a, s; b := arg[1]; r := rec( @@ -191,9 +195,11 @@ ColorPrompt := function(arg) EndLineHook := function() WriteAll(STDOut, "\033[0m"); end; -end; +end ); -# now, that the file is in the GAP library, the default is no colored prompt +# Switch off colors for the moment. +# The default for the GAP session will be set in 'init.g', +# by evaluating the user preference 'UseColorPrompt'. ColorPrompt(false); # The coloring of the prompt after startup can be configured via a user