Commit f442d348 authored by Jason Rumney's avatar Jason Rumney
Browse files

(w32_face_attributes): Don't use color indexes that are out of range.

Only reverse the default colors.
parent 182aef95
...@@ -506,22 +506,24 @@ w32_face_attributes (f, face_id) ...@@ -506,22 +506,24 @@ w32_face_attributes (f, face_id)
char_attr = char_attr_normal; char_attr = char_attr_normal;
if (face->foreground != FACE_TTY_DEFAULT_FG_COLOR /* Reverse the default color if requested. If background and
&& face->foreground != FACE_TTY_DEFAULT_COLOR) foreground are specified, then they have been reversed already. */
char_attr = (char_attr & 0xfff0) + (face->foreground % 16); if (face->tty_reverse_p)
char_attr = (char_attr & 0xff00) + ((char_attr & 0x000f) << 4)
if (face->background != FACE_TTY_DEFAULT_BG_COLOR + ((char_attr & 0x00f0) >> 4);
&& face->background != FACE_TTY_DEFAULT_COLOR)
char_attr = (char_attr & 0xff0f) + ((face->background % 16) << 4);
/* Before the terminal is properly initialized, all colors map to 0. /* Before the terminal is properly initialized, all colors map to 0.
If we get a face like this, use the normal terminal attributes. */ Don't try to resolve them. */
if (NILP (Vtty_defined_color_alist)) if (NILP (Vtty_defined_color_alist))
char_attr = char_attr_normal; return char_attr;
if (face->tty_reverse_p) if (face->foreground >= 0
char_attr = (char_attr & 0xff00) + ((char_attr & 0x000f) << 4) && face->foreground < 16)
+ ((char_attr & 0x00f0) >> 4); char_attr = (char_attr & 0xfff0) + face->foreground;
if (face->background >= 0
&& face->background < 16)
char_attr = (char_attr & 0xff0f) + (face->background << 4);
return char_attr; return char_attr;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment