summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_main.c2
-rw-r--r--Src/Zle/zle_refresh.c57
3 files changed, 34 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index 4b9713fb5..7fd634250 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-10-19 Geoff Wing <gcw@zsh.org>
+
+ * 23924: Src/Zle/zle_main.c, Src/Zle/zle_refresh.c: Improve
+ synchronising of character attributes with other output routines
+
2007-10-18 Clint Adams <clint@zsh.org>
* Mikael Magnusson: 23991: Completion/Unix/Command/_git: fix
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 463ff157f..a45e63617 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1678,8 +1678,10 @@ reexpandprompt(void)
if (!reexpanding++) {
free(lpromptbuf);
lpromptbuf = promptexpand(raw_lp ? *raw_lp : NULL, 1, NULL, NULL);
+ pmpt_attr = txtchange;
free(rpromptbuf);
rpromptbuf = promptexpand(raw_rp ? *raw_rp : NULL, 1, NULL, NULL);
+ rpmpt_attr = txtchange;
}
reexpanding--;
}
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index a936a1399..2dfafb932 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -413,6 +413,23 @@ snextline(Rparams rpms)
rpms->sen = rpms->s + winw;
}
+/**/
+static void
+settextattributes(void)
+{
+ if (txtchangeisset(TXTNOBOLDFACE))
+ tsetcap(TCALLATTRSOFF, 0);
+ if (txtchangeisset(TXTNOSTANDOUT))
+ tsetcap(TCSTANDOUTEND, 0);
+ if (txtchangeisset(TXTNOUNDERLINE))
+ tsetcap(TCUNDERLINEEND, 0);
+ if (txtchangeisset(TXTBOLDFACE))
+ tsetcap(TCBOLDFACEBEG, 0);
+ if (txtchangeisset(TXTSTANDOUT))
+ tsetcap(TCSTANDOUTBEG, 0);
+ if (txtchangeisset(TXTUNDERLINE))
+ tsetcap(TCUNDERLINEBEG, 0);
+}
/**/
mod_export void
@@ -429,11 +446,9 @@ zrefresh(void)
int tmpcs, tmpll; /* ditto cursor position and line length */
int tmpalloced; /* flag to free tmpline when finished */
int remetafy; /* flag that zle line is metafied */
+ int fixprompt; /* we still need to reexpand the prompt */
struct rparams rpms;
- if (trashedzle)
- reexpandprompt();
-
/* If this is called from listmatches() (indirectly via trashzle()), and *
* that was called from the end of zrefresh(), then we don't need to do *
* anything. All this `inlist' code is actually unnecessary, but it *
@@ -525,6 +540,7 @@ zrefresh(void)
listshown = 0;
}
#endif
+ fixprompt = trashedzle;
resetvideo();
resetneeded = 0; /* unset */
oput_rpmpt = 0; /* no right-prompt currently on screen */
@@ -533,6 +549,8 @@ zrefresh(void)
tsetcap(TCALLATTRSOFF, 0);
tsetcap(TCSTANDOUTEND, 0);
tsetcap(TCUNDERLINEEND, 0);
+ /* cheat on attribute unset */
+ txtunset(TXTBOLDFACE|TXTSTANDOUT|TXTUNDERLINE|TXTDIRTY);
if (!clearflag) {
if (tccan(TCCLEAREOD))
@@ -544,26 +562,17 @@ zrefresh(void)
}
if (t0 > -1)
olnct = (t0 < winh) ? t0 : winh;
+ if (fixprompt)
+ reexpandprompt();
if (termflags & TERM_SHORT)
vcs = 0;
- else if (!clearflag && lpromptbuf[0]) {
+ else if (!clearflag && lpromptbuf[0]) {
zputs(lpromptbuf, shout);
if (lpromptwof == winw)
zputs("\n", shout); /* works with both hasam and !hasam */
} else {
txtchange = pmpt_attr;
- if (txtchangeisset(TXTNOBOLDFACE))
- tsetcap(TCALLATTRSOFF, 0);
- if (txtchangeisset(TXTNOSTANDOUT))
- tsetcap(TCSTANDOUTEND, 0);
- if (txtchangeisset(TXTNOUNDERLINE))
- tsetcap(TCUNDERLINEEND, 0);
- if (txtchangeisset(TXTBOLDFACE))
- tsetcap(TCBOLDFACEBEG, 0);
- if (txtchangeisset(TXTSTANDOUT))
- tsetcap(TCSTANDOUTBEG, 0);
- if (txtchangeisset(TXTUNDERLINE))
- tsetcap(TCUNDERLINEBEG, 0);
+ settextattributes();
}
if (clearflag) {
zputc(ZWC('\r'));
@@ -872,20 +881,8 @@ individually */
/* reset character attributes */
if (clearf && postedit) {
- if ((txtchange = pmpt_attr ? pmpt_attr : rpmpt_attr)) {
- if (txtchangeisset(TXTNOBOLDFACE))
- tsetcap(TCALLATTRSOFF, 0);
- if (txtchangeisset(TXTNOSTANDOUT))
- tsetcap(TCSTANDOUTEND, 0);
- if (txtchangeisset(TXTNOUNDERLINE))
- tsetcap(TCUNDERLINEEND, 0);
- if (txtchangeisset(TXTBOLDFACE))
- tsetcap(TCBOLDFACEBEG, 0);
- if (txtchangeisset(TXTSTANDOUT))
- tsetcap(TCSTANDOUTBEG, 0);
- if (txtchangeisset(TXTUNDERLINE))
- tsetcap(TCUNDERLINEBEG, 0);
- }
+ if ((txtchange = pmpt_attr ? pmpt_attr : rpmpt_attr))
+ settextattributes();
}
clearf = 0;
oput_rpmpt = put_rpmpt;