1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-06 11:21:22 +02:00

38809: fix tracking of colour attributes and restore them when turning bold off

This commit is contained in:
Oliver Kiddle 2016-07-08 22:28:15 +02:00
parent fc286168ed
commit e87aa8941f
4 changed files with 14 additions and 7 deletions

View file

@ -1,5 +1,9 @@
2016-07-08 Oliver Kiddle <opk@zsh.org>
* 38809: Src/zsh.h, Src/prompt.c, Src/Zle/zle_refresh.c:
fix tracking of colour attributes and restore them when
turning bold off
* unposted: Doc/Zsh/builtins.yo, Doc/Zsh/compsys.yo,
Doc/Zsh/options.yo, Doc/Zsh/zle.yo: fix duplicated words

View file

@ -1143,8 +1143,7 @@ zrefresh(void)
tsetcap(TCALLATTRSOFF, 0);
tsetcap(TCSTANDOUTEND, 0);
tsetcap(TCUNDERLINEEND, 0);
/* cheat on attribute unset */
txtunset(TXTBOLDFACE|TXTSTANDOUT|TXTUNDERLINE);
txtattrmask = 0;
if (trashedzle && !clearflag)
reexpandprompt();

View file

@ -523,8 +523,6 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
break;
case 'b':
txtchangeset(txtchangep, TXTNOBOLDFACE, TXTBOLDFACE);
txtchangeset(txtchangep, TXTNOSTANDOUT, TXTSTANDOUT);
txtchangeset(txtchangep, TXTNOUNDERLINE, TXTUNDERLINE);
txtunset(TXTBOLDFACE);
tsetcap(TCALLATTRSOFF, TSC_PROMPT|TSC_DIRTY);
break;
@ -542,7 +540,8 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
arg = parsecolorchar(arg, 1);
if (arg >= 0 && !(arg & TXTNOFGCOLOUR)) {
txtchangeset(txtchangep, arg & TXT_ATTR_FG_ON_MASK,
TXTNOFGCOLOUR);
TXTNOFGCOLOUR | TXT_ATTR_FG_COL_MASK);
txtunset(TXT_ATTR_FG_COL_MASK);
txtset(arg & TXT_ATTR_FG_ON_MASK);
set_colour_attribute(arg, COL_SEQ_FG, TSC_PROMPT);
break;
@ -557,7 +556,8 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
arg = parsecolorchar(arg, 0);
if (arg >= 0 && !(arg & TXTNOBGCOLOUR)) {
txtchangeset(txtchangep, arg & TXT_ATTR_BG_ON_MASK,
TXTNOBGCOLOUR);
TXTNOBGCOLOUR | TXT_ATTR_BG_COL_MASK);
txtunset(TXT_ATTR_BG_COL_MASK);
txtset(arg & TXT_ATTR_BG_ON_MASK);
set_colour_attribute(arg, COL_SEQ_BG, TSC_PROMPT);
break;
@ -1041,6 +1041,10 @@ tsetcap(int cap, int flags)
tsetcap(TCSTANDOUTBEG, flags);
if (txtisset(TXTUNDERLINE))
tsetcap(TCUNDERLINEBEG, flags);
if (txtisset(TXTFGCOLOUR))
set_colour_attribute(txtattrmask, COL_SEQ_FG, TSC_PROMPT);
if (txtisset(TXTBGCOLOUR))
set_colour_attribute(txtattrmask, COL_SEQ_BG, TSC_PROMPT);
}
}
}

View file

@ -2567,7 +2567,7 @@ struct ttyinfo {
#define txtchangeisset(T,X) ((T) & (X))
#define txtchangeget(T,A) (((T) & A ## _MASK) >> A ## _SHIFT)
#define txtchangeset(T, X, Y) ((void)(T && (*T |= (X), *T &= ~(Y))))
#define txtchangeset(T, X, Y) ((void)(T && (*T &= ~(Y), *T |= (X))))
/*
* For outputting sequences to change colour: specify foreground