about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2023-01-10 20:57:03 +0100
committerOliver Kiddle <opk@zsh.org>2023-01-10 20:57:03 +0100
commitc01479a2ede78b9b53057322e4b9f5bd0a103a00 (patch)
treefb02cafa81ade7ee2dbbfc72c81b09c8d9add1bb /Src/Zle
parent667ead3a64e590ac758e9f0a053849c7aaccec66 (diff)
downloadzsh-c01479a2ede78b9b53057322e4b9f5bd0a103a00.tar.gz
zsh-c01479a2ede78b9b53057322e4b9f5bd0a103a00.tar.xz
zsh-c01479a2ede78b9b53057322e4b9f5bd0a103a00.zip
51280: add support for italic and faint fonts in the line editor
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_refresh.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index ae8e5c109..d40400886 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -1193,23 +1193,10 @@ zrefresh(void)
 		offset = predisplaylen; /* increment over it */
 	    if (rhp->start + offset <= tmppos &&
 		tmppos < rhp->end + offset) {
-		if (rhp->atr & (TXTFGCOLOUR|TXTBGCOLOUR)) {
-		    /* override colour with later entry */
-		    base_attr = rhp->atr;
-		} else {
-		    /* no colour set yet */
-		    base_attr |= rhp->atr;
-		}
+		base_attr = mixattrs(rhp->atr, base_attr);
 	    }
 	}
-	if (special_attr & (TXTFGCOLOUR|TXTBGCOLOUR)) {
-	    /* keep colours from special attributes */
-	    all_attr = special_attr |
-		(base_attr & ~TXT_ATTR_COLOUR_MASK);
-	} else {
-	    /* keep colours from standard attributes */
-	    all_attr = special_attr | base_attr;
-	}
+	all_attr = mixattrs(special_attr, base_attr);
 
 	if (t == scs)			/* if cursor is here, remember it */
 	    rpms.nvcs = rpms.s - nbuf[rpms.nvln = rpms.ln];
@@ -2441,14 +2428,7 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs)
 		}
 	    }
 	}
-	if (special_attr & (TXTFGCOLOUR|TXTBGCOLOUR)) {
-	    /* keep colours from special attributes */
-	    all_attr = special_attr |
-		(base_attr & ~TXT_ATTR_COLOUR_MASK);
-	} else {
-	    /* keep colours from standard attributes */
-	    all_attr = special_attr | base_attr;
-	}
+	all_attr = mixattrs(special_attr, base_attr);
 
 	if (tmpline[t0] == ZWC('\t')) {
 	    for (*vp++ = zr_sp; (vp - vbuf) & 7; )