diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2008-05-09 17:33:49 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-05-09 17:33:49 +0000 |
commit | c811a18d44c4720572504065bc1b83371b8998b2 (patch) | |
tree | 201687655489fbbfd782e4807ce5bcf7d775c97e /Src/zsh.h | |
parent | f7246fb559da77ac718b610132cdfb6ea07dc686 (diff) | |
download | zsh-c811a18d44c4720572504065bc1b83371b8998b2.tar.gz zsh-c811a18d44c4720572504065bc1b83371b8998b2.tar.xz zsh-c811a18d44c4720572504065bc1b83371b8998b2.zip |
24986: prompt escapes for colours
Diffstat (limited to 'Src/zsh.h')
-rw-r--r-- | Src/zsh.h | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/Src/zsh.h b/Src/zsh.h index 2f7c4fefe..13bae0585 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -1975,7 +1975,6 @@ struct ttyinfo { #define TXTUNDERLINE 0x0004 #define TXTFGCOLOUR 0x0008 #define TXTBGCOLOUR 0x0010 -#define TXTDIRTY 0x0020 #define TXT_ATTR_ON_MASK 0x001F @@ -1983,15 +1982,15 @@ struct ttyinfo { #define txtset(X) (txtattrmask |= (X)) #define txtunset(X) (txtattrmask &= ~(X)) -#define TXTNOBOLDFACE 0x0040 -#define TXTNOSTANDOUT 0x0080 -#define TXTNOUNDERLINE 0x0100 -#define TXTNOFGCOLOUR 0x0200 -#define TXTNOBGCOLOUR 0x0400 +#define TXTNOBOLDFACE 0x0020 +#define TXTNOSTANDOUT 0x0040 +#define TXTNOUNDERLINE 0x0080 +#define TXTNOFGCOLOUR 0x0100 +#define TXTNOBGCOLOUR 0x0200 -#define TXT_ATTR_OFF_MASK 0x07C0 +#define TXT_ATTR_OFF_MASK 0x03E0 /* Bits to shift off right to get on */ -#define TXT_ATTR_OFF_ON_SHIFT 6 +#define TXT_ATTR_OFF_ON_SHIFT 5 #define TXT_ATTR_OFF_FROM_ON(attr) \ (((attr) & TXT_ATTR_ON_MASK) << TXT_ATTR_OFF_ON_SHIFT) #define TXT_ATTR_ON_FROM_OFF(attr) \ @@ -2000,7 +1999,7 @@ struct ttyinfo { * Indicates to zle_refresh.c that the character entry is an * index into the list of multiword symbols. */ -#define TXT_MULTIWORD_MASK 0x0800 +#define TXT_MULTIWORD_MASK 0x0400 /* Mask for colour to use in foreground */ #define TXT_ATTR_FG_COL_MASK 0x000FF000 @@ -2021,16 +2020,45 @@ struct ttyinfo { (TXT_ATTR_ON_MASK|TXT_ATTR_FG_COL_MASK|TXT_ATTR_BG_COL_MASK|\ TXT_ATTR_FG_TERMCAP|TXT_ATTR_BG_TERMCAP) +/* Mask out everything to do with setting a foreground colour */ +#define TXT_ATTR_FG_ON_MASK \ + (TXTFGCOLOUR|TXT_ATTR_FG_COL_MASK|TXT_ATTR_FG_TERMCAP) + +/* Mask out everything to do with setting a background colour */ +#define TXT_ATTR_BG_ON_MASK \ + (TXTBGCOLOUR|TXT_ATTR_BG_COL_MASK|TXT_ATTR_BG_TERMCAP) + /* Mask out everything to do with activating colours */ #define TXT_ATTR_COLOUR_ON_MASK \ - (TXTFGCOLOUR|TXTBGCOLOUR| \ - TXT_ATTR_FG_COL_MASK|TXT_ATTR_BG_COL_MASK| \ - TXT_ATTR_FG_TERMCAP|TXT_ATTR_BG_TERMCAP) + (TXT_ATTR_FG_ON_MASK|TXT_ATTR_BG_ON_MASK) #define txtchangeisset(T,X) ((T) & (X)) #define txtchangeget(T,A) (((T) & A ## _MASK) >> A ## _SHIFT) #define txtchangeset(X, Y) (txtchange |= (X), txtchange &= ~(Y)) +/* + * For outputting sequences to change colour: specify foreground + * or background. + */ +#define COL_SEQ_FG (0) +#define COL_SEQ_BG (1) +#define COL_SEQ_COUNT (2) + +/* + * Flags to testcap() and set_colour_attribute (which currently only + * handles TSC_PROMPT). + */ +enum { + /* Raw output: use stdout rather than shout */ + TSC_RAW = 0x0001, + /* Output to current prompt buffer: only used when assembling prompt */ + TSC_PROMPT = 0x0002, + /* Mask to get the output mode */ + TSC_OUTPUT_MASK = 0x0003, + /* Change needs reset of other attributes */ + TSC_DIRTY = 0x0004 +}; + /****************************************/ /* Definitions for the %_ prompt escape */ /****************************************/ |