GUACAMOLE-280: Merge low intensity SGR option.

This commit is contained in:
James Muehlner 2017-05-26 18:11:06 -07:00
commit 9ee224f2ca
4 changed files with 27 additions and 7 deletions

View File

@ -118,7 +118,7 @@ int __guac_terminal_set_colors(guac_terminal_display* display,
}
/* Handle bold */
if (attributes->bold
if (attributes->bold && !attributes->half_bright
&& foreground->palette_index >= GUAC_TERMINAL_FIRST_DARK
&& foreground->palette_index <= GUAC_TERMINAL_LAST_DARK) {
foreground = &guac_terminal_palette[foreground->palette_index
@ -128,6 +128,13 @@ int __guac_terminal_set_colors(guac_terminal_display* display,
display->glyph_foreground = *foreground;
display->glyph_background = *background;
/* Modify color if half-bright (low intensity) */
if (attributes->half_bright && !attributes->bold) {
display->glyph_foreground.red /= 2;
display->glyph_foreground.green /= 2;
display->glyph_foreground.blue /= 2;
}
return 0;
}

View File

@ -299,6 +299,7 @@ guac_terminal* guac_terminal_create(guac_client* client,
.foreground = guac_terminal_palette[default_foreground],
.background = guac_terminal_palette[default_background],
.bold = false,
.half_bright = false,
.reverse = false,
.underscore = false
},

View File

@ -46,6 +46,12 @@ typedef struct guac_terminal_attributes {
*/
bool bold;
/**
* Whether the character should be rendered with half brightness (faint
* or low intensity).
*/
bool half_bright;
/**
* Whether the character should be rendered with reversed colors
* (background becomes foreground and vice-versa).

View File

@ -897,6 +897,10 @@ int guac_terminal_csi(guac_terminal* term, unsigned char c) {
else if (value == 1)
term->current_attributes.bold = true;
/* Faint (low intensity) */
else if (value == 2)
term->current_attributes.half_bright = true;
/* Underscore on */
else if (value == 4)
term->current_attributes.underscore = true;
@ -906,8 +910,10 @@ int guac_terminal_csi(guac_terminal* term, unsigned char c) {
term->current_attributes.reverse = true;
/* Normal intensity (not bold) */
else if (value == 21 || value == 22)
else if (value == 21 || value == 22) {
term->current_attributes.bold = false;
term->current_attributes.half_bright = false;
}
/* Reset underscore */
else if (value == 24)