]> Sergey Matveev's repositories - st.git/blobdiff - x.c
Coloured italics
[st.git] / x.c
diff --git a/x.c b/x.c
index aa0999708da84930a9752da8dd6d5bdc9991bb5d..4ef3fdedf3c4e4e46c10d53bcb8284a491372b74 100644 (file)
--- a/x.c
+++ b/x.c
@@ -818,7 +818,7 @@ xloadcols(void)
 int
 xgetcolor(int x, unsigned char *r, unsigned char *g, unsigned char *b)
 {
-       if (!BETWEEN(x, 0, dc.collen))
+       if (!BETWEEN(x, 0, dc.collen - 1))
                return 1;
 
        *r = dc.col[x].color.red >> 8;
@@ -833,7 +833,7 @@ xsetcolorname(int x, const char *name)
 {
        Color ncolor;
 
-       if (!BETWEEN(x, 0, dc.collen))
+       if (!BETWEEN(x, 0, dc.collen - 1))
                return 1;
 
        if (!xloadcolor(x, name, &ncolor))
@@ -1381,12 +1381,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
        XRenderColor colfg, colbg;
        XRectangle r;
 
-       /* Fallback on color display for attributes not supported by the font */
-       if (base.mode & ATTR_ITALIC && base.mode & ATTR_BOLD) {
-               if (dc.ibfont.badslant || dc.ibfont.badweight)
-                       base.fg = defaultattr;
-       } else if ((base.mode & ATTR_ITALIC && dc.ifont.badslant) ||
-           (base.mode & ATTR_BOLD && dc.bfont.badweight)) {
+       if (base.mode & ATTR_ITALIC) {
                base.fg = defaultattr;
        }
 
@@ -1617,6 +1612,9 @@ xseticontitle(char *p)
        XTextProperty prop;
        DEFAULT(p, opt_title);
 
+       if (p[0] == '\0')
+               p = opt_title;
+
        if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
                                        &prop) != Success)
                return;
@@ -1631,6 +1629,9 @@ xsettitle(char *p)
        XTextProperty prop;
        DEFAULT(p, opt_title);
 
+       if (p[0] == '\0')
+               p = opt_title;
+
        if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
                                        &prop) != Success)
                return;