mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-01 18:30:55 +01:00
24932: try to fix up code that regularizes attributes after right prompt
This commit is contained in:
parent
2b2cb523eb
commit
88126c0110
3 changed files with 38 additions and 18 deletions
|
|
@ -1,5 +1,8 @@
|
|||
2008-05-06 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 24932: Src/zsh.h, Src/Zle/zle_refresh.c: try to regularize
|
||||
code that fixes up after right prompt.
|
||||
|
||||
* 24927: Phil Pennock: configure.ac: Free BSD only doesn't need
|
||||
_XOPEN_SOURCE_EXTENDED on Free BSD 6.
|
||||
|
||||
|
|
|
|||
|
|
@ -1869,29 +1869,44 @@ zrefresh(void)
|
|||
|
||||
/* output the right-prompt if appropriate */
|
||||
if (put_rpmpt && !iln && !oput_rpmpt) {
|
||||
int attrchange;
|
||||
|
||||
moveto(0, winw - 1 - rpromptw);
|
||||
zputs(rpromptbuf, shout);
|
||||
vcs = winw - 1;
|
||||
/* reset character attributes to that set by the main prompt */
|
||||
txtchange = pmpt_attr;
|
||||
if (txtchangeisset(txtchange, TXTNOBOLDFACE) &&
|
||||
(rpmpt_attr & TXTBOLDFACE))
|
||||
tsetcap(TCALLATTRSOFF, 0);
|
||||
if (txtchangeisset(txtchange, TXTNOSTANDOUT) &&
|
||||
(rpmpt_attr & TXTSTANDOUT))
|
||||
tsetcap(TCSTANDOUTEND, 0);
|
||||
if (txtchangeisset(txtchange, TXTNOUNDERLINE) &&
|
||||
(rpmpt_attr & TXTUNDERLINE))
|
||||
tsetcap(TCUNDERLINEEND, 0);
|
||||
if (txtchangeisset(txtchange, TXTBOLDFACE) &&
|
||||
(rpmpt_attr & TXTNOBOLDFACE))
|
||||
tsetcap(TCBOLDFACEBEG, 0);
|
||||
if (txtchangeisset(txtchange, TXTSTANDOUT) &&
|
||||
(rpmpt_attr & TXTNOSTANDOUT))
|
||||
tsetcap(TCSTANDOUTBEG, 0);
|
||||
if (txtchangeisset(txtchange, TXTUNDERLINE) &&
|
||||
(rpmpt_attr & TXTNOUNDERLINE))
|
||||
tsetcap(TCUNDERLINEBEG, 0);
|
||||
/*
|
||||
* Keep attributes that have actually changed,
|
||||
* which are ones off in rpmpt_attr and on in
|
||||
* pmpt_attr, and vice versa.
|
||||
*/
|
||||
attrchange = txtchange &
|
||||
(TXT_ATTR_OFF_FROM_ON(rpmpt_attr) |
|
||||
TXT_ATTR_ON_FROM_OFF(rpmpt_attr));
|
||||
/*
|
||||
* Careful in case the colour changed.
|
||||
*/
|
||||
if (txtchangeisset(txtchange, TXTFGCOLOUR) &&
|
||||
(!txtchangeisset(rpmpt_attr, TXTFGCOLOUR) ||
|
||||
((txtchange ^ rpmpt_attr) & TXT_ATTR_FG_COL_MASK)))
|
||||
{
|
||||
attrchange |=
|
||||
txtchange & (TXTFGCOLOUR | TXT_ATTR_FG_COL_MASK);
|
||||
}
|
||||
if (txtchangeisset(txtchange, TXTBGCOLOUR) &&
|
||||
(!txtchangeisset(rpmpt_attr, TXTBGCOLOUR) ||
|
||||
((txtchange ^ rpmpt_attr) & TXT_ATTR_BG_COL_MASK)))
|
||||
{
|
||||
attrchange |=
|
||||
txtchange & (TXTBGCOLOUR | TXT_ATTR_BG_COL_MASK);
|
||||
}
|
||||
/*
|
||||
* Now feed these changes into the usual function,
|
||||
* if necessary.
|
||||
*/
|
||||
if (attrchange)
|
||||
settextattributes(attrchange);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1983,6 +1983,8 @@ struct ttyinfo {
|
|||
#define TXT_ATTR_OFF_ON_SHIFT 6
|
||||
#define TXT_ATTR_OFF_FROM_ON(attr) \
|
||||
(((attr) & TXT_ATTR_ON_MASK) << TXT_ATTR_OFF_ON_SHIFT)
|
||||
#define TXT_ATTR_ON_FROM_OFF(attr) \
|
||||
(((attr) & TXT_ATTR_OFF_MASK) >> TXT_ATTR_OFF_ON_SHIFT)
|
||||
/*
|
||||
* Indicates to zle_refresh.c that the character entry is an
|
||||
* index into the list of multiword symbols.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue