summaryrefslogtreecommitdiff
path: root/Src/prompt.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2019-01-25 22:46:55 +0100
committerAxel Beckert <abe@deuxchevaux.org>2019-01-25 22:46:55 +0100
commit7b75d97c1e43461a844be04ae4d36c3437213fa7 (patch)
tree5301a4a542b5731bc3f46babe340a5edd44587bc /Src/prompt.c
parent95401e8336912dab76912adc7b45e6337fc436a3 (diff)
parent9799d0f9a2bd3a13fe52dbb9bc4d86f874dc1e14 (diff)
downloadzsh-7b75d97c1e43461a844be04ae4d36c3437213fa7.tar.gz
zsh-7b75d97c1e43461a844be04ae4d36c3437213fa7.zip
New upstream release 5.7
Merge branch 'upstream' at 'zsh-5.7' into branch debian
Diffstat (limited to 'Src/prompt.c')
-rw-r--r--Src/prompt.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/Src/prompt.c b/Src/prompt.c
index 135aca942..4603ffba6 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -2018,11 +2018,13 @@ set_colour_attribute(zattr atr, int fg_bg, int flags)
/* Test if current zle_highlight settings are customized, or
* the typical "standard" codes */
- if (0 != strcmp(fg_bg_sequences[fg_bg].start, fg_bg == COL_SEQ_FG ? "\e[3" : "\e[4") ||
- 0 != strcmp(fg_bg_sequences[fg_bg].def, "9") || /* the same in-fix for both FG and BG */
- 0 != strcmp(fg_bg_sequences[fg_bg].end, "m") /* the same suffix for both FG and BG */
- ) {
- is_default_zle_highlight = 0;
+ if (0 != strcmp(fg_bg_sequences[fg_bg].start, fg_bg == COL_SEQ_FG ? TC_COL_FG_START : TC_COL_BG_START) ||
+ /* the same in-fix for both FG and BG */
+ 0 != strcmp(fg_bg_sequences[fg_bg].def, TC_COL_FG_DEFAULT) ||
+ /* the same suffix for both FG and BG */
+ 0 != strcmp(fg_bg_sequences[fg_bg].end, TC_COL_FG_END))
+ {
+ is_default_zle_highlight = 0;
}
/*
@@ -2035,7 +2037,9 @@ set_colour_attribute(zattr atr, int fg_bg, int flags)
* highlighting variables, so much of this shouldn't be
* necessary at this point, but we might as well be safe.
*/
- if (!def && !use_truecolor && (is_default_zle_highlight && (colour > 7 || use_termcap))) {
+ if (!def && !use_truecolor &&
+ (is_default_zle_highlight && (colour > 7 || use_termcap)))
+ {
/*
* We can if it's available, and either we couldn't get
* the maximum number of colours, or the colour is in range.
@@ -2077,21 +2081,30 @@ set_colour_attribute(zattr atr, int fg_bg, int flags)
* or the typical true-color code: .start + 8;2;%d;%d;%d + .end
* or the typical 256-color code: .start + 8;5;%d + .end
*/
- strcpy(colseq_buf, fg_bg_sequences[fg_bg].start);
+ if (use_truecolor)
+ strcpy(colseq_buf, fg_bg == COL_SEQ_FG ? TC_COL_FG_START : TC_COL_BG_START);
+ else
+ strcpy(colseq_buf, fg_bg_sequences[fg_bg].start);
ptr = colseq_buf + strlen(colseq_buf);
if (def) {
- strcpy(ptr, fg_bg_sequences[fg_bg].def);
+ if (use_truecolor)
+ strcpy(ptr, fg_bg == COL_SEQ_FG ? TC_COL_FG_DEFAULT : TC_COL_BG_DEFAULT);
+ else
+ strcpy(ptr, fg_bg_sequences[fg_bg].def);
while (*ptr)
ptr++;
} else if (use_truecolor) {
ptr += sprintf(ptr, "8;2;%d;%d;%d", colour >> 16,
(colour >> 8) & 0xff, colour & 0xff);
} else if (colour > 7 && colour <= 255) {
- ptr += sprintf(ptr, "8;5;%d", colour);
+ ptr += sprintf(ptr, "%d", colour);
} else
*ptr++ = colour + '0';
- strcpy(ptr, fg_bg_sequences[fg_bg].end);
+ if (use_truecolor)
+ strcpy(ptr, fg_bg == COL_SEQ_FG ? TC_COL_FG_END : TC_COL_BG_END);
+ else
+ strcpy(ptr, fg_bg_sequences[fg_bg].end);
if (is_prompt) {
if (!bv->dontcount) {