GUACAMOLE-280: Add support for faint (low) intensity SGR.

This commit is contained in:
Michael Jumper 2017-05-21 13:34:30 -07:00
parent 6d2cfdabf8
commit 2146200dfd
4 changed files with 26 additions and 6 deletions

View File

@ -128,6 +128,13 @@ int __guac_terminal_set_colors(guac_terminal_display* display,
display->glyph_foreground = *foreground; display->glyph_foreground = *foreground;
display->glyph_background = *background; display->glyph_background = *background;
/* Modify color if half-bright (low intensity) */
if (attributes->half_bright) {
display->glyph_foreground.red /= 2;
display->glyph_foreground.green /= 2;
display->glyph_foreground.blue /= 2;
}
return 0; return 0;
} }

View File

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

View File

@ -46,6 +46,12 @@ typedef struct guac_terminal_attributes {
*/ */
bool bold; 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 * Whether the character should be rendered with reversed colors
* (background becomes foreground and vice-versa). * (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) else if (value == 1)
term->current_attributes.bold = true; term->current_attributes.bold = true;
/* Faint (low intensity) */
else if (value == 2)
term->current_attributes.half_bright = true;
/* Underscore on */ /* Underscore on */
else if (value == 4) else if (value == 4)
term->current_attributes.underscore = true; term->current_attributes.underscore = true;
@ -906,8 +910,10 @@ int guac_terminal_csi(guac_terminal* term, unsigned char c) {
term->current_attributes.reverse = true; term->current_attributes.reverse = true;
/* Normal intensity (not bold) */ /* Normal intensity (not bold) */
else if (value == 21 || value == 22) else if (value == 21 || value == 22) {
term->current_attributes.bold = false; term->current_attributes.bold = false;
term->current_attributes.half_bright = false;
}
/* Reset underscore */ /* Reset underscore */
else if (value == 24) else if (value == 24)