|
|
@ -542,8 +542,36 @@ do_csi_sgr(CSI_Data *opts) |
|
|
|
// -- set color --
|
|
|
|
// -- set color --
|
|
|
|
else if (n >= SGR_FG_START && n <= SGR_FG_END) screen_set_fg((Color) (n - SGR_FG_START)); // ANSI normal fg
|
|
|
|
else if (n >= SGR_FG_START && n <= SGR_FG_END) screen_set_fg((Color) (n - SGR_FG_START)); // ANSI normal fg
|
|
|
|
else if (n >= SGR_BG_START && n <= SGR_BG_END) screen_set_bg((Color) (n - SGR_BG_START)); // ANSI normal bg
|
|
|
|
else if (n >= SGR_BG_START && n <= SGR_BG_END) screen_set_bg((Color) (n - SGR_BG_START)); // ANSI normal bg
|
|
|
|
|
|
|
|
// AIX bright colors --
|
|
|
|
|
|
|
|
else if (n >= SGR_FG_BRT_START && n <= SGR_FG_BRT_END) screen_set_fg((Color) ((n - SGR_FG_BRT_START) + 8)); // AIX bright fg
|
|
|
|
|
|
|
|
else if (n >= SGR_BG_BRT_START && n <= SGR_BG_BRT_END) screen_set_bg((Color) ((n - SGR_BG_BRT_START) + 8)); // AIX bright bg
|
|
|
|
|
|
|
|
// reset color
|
|
|
|
else if (n == SGR_FG_DEFAULT) screen_set_fg(termconf_scratch.default_fg); // default fg
|
|
|
|
else if (n == SGR_FG_DEFAULT) screen_set_fg(termconf_scratch.default_fg); // default fg
|
|
|
|
else if (n == SGR_BG_DEFAULT) screen_set_bg(termconf_scratch.default_bg); // default bg
|
|
|
|
else if (n == SGR_BG_DEFAULT) screen_set_bg(termconf_scratch.default_bg); // default bg
|
|
|
|
|
|
|
|
// 256 colors
|
|
|
|
|
|
|
|
else if (n == SGR_FG_256 || n == SGR_BG_256) { |
|
|
|
|
|
|
|
if (i < count-2) { |
|
|
|
|
|
|
|
if (opts->n[i + 1] == 5) { |
|
|
|
|
|
|
|
int color = opts->n[i + 2]; |
|
|
|
|
|
|
|
bool fg = n == SGR_FG_256; |
|
|
|
|
|
|
|
if (fg) { |
|
|
|
|
|
|
|
screen_set_fg_ext(color); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
screen_set_bg_ext(color); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
ansi_warn("SGR syntax err"); |
|
|
|
|
|
|
|
apars_show_context(); |
|
|
|
|
|
|
|
break; // abandon further
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
i += 2; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ansi_warn("SGR syntax err"); |
|
|
|
|
|
|
|
apars_show_context(); |
|
|
|
|
|
|
|
break; // abandon further
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// -- set attr --
|
|
|
|
// -- set attr --
|
|
|
|
else if (n == SGR_BOLD) screen_set_sgr(ATTR_BOLD, 1); |
|
|
|
else if (n == SGR_BOLD) screen_set_sgr(ATTR_BOLD, 1); |
|
|
|
else if (n == SGR_FAINT) screen_set_sgr(ATTR_FAINT, 1); |
|
|
|
else if (n == SGR_FAINT) screen_set_sgr(ATTR_FAINT, 1); |
|
|
@ -553,6 +581,7 @@ do_csi_sgr(CSI_Data *opts) |
|
|
|
else if (n == SGR_STRIKE) screen_set_sgr(ATTR_STRIKE, 1); |
|
|
|
else if (n == SGR_STRIKE) screen_set_sgr(ATTR_STRIKE, 1); |
|
|
|
else if (n == SGR_FRAKTUR) screen_set_sgr(ATTR_FRAKTUR, 1); |
|
|
|
else if (n == SGR_FRAKTUR) screen_set_sgr(ATTR_FRAKTUR, 1); |
|
|
|
else if (n == SGR_INVERSE) screen_set_sgr_inverse(1); |
|
|
|
else if (n == SGR_INVERSE) screen_set_sgr_inverse(1); |
|
|
|
|
|
|
|
else if (n == SGR_CONCEAL) screen_set_sgr_conceal(1); |
|
|
|
// -- clear attr --
|
|
|
|
// -- clear attr --
|
|
|
|
else if (n == SGR_OFF(SGR_BOLD)) screen_set_sgr(ATTR_BOLD, 0); // can also mean "Double Underline"
|
|
|
|
else if (n == SGR_OFF(SGR_BOLD)) screen_set_sgr(ATTR_BOLD, 0); // can also mean "Double Underline"
|
|
|
|
else if (n == SGR_OFF(SGR_FAINT)) screen_set_sgr(ATTR_FAINT | ATTR_BOLD, 0); // "normal"
|
|
|
|
else if (n == SGR_OFF(SGR_FAINT)) screen_set_sgr(ATTR_FAINT | ATTR_BOLD, 0); // "normal"
|
|
|
@ -561,9 +590,7 @@ do_csi_sgr(CSI_Data *opts) |
|
|
|
else if (n == SGR_OFF(SGR_BLINK)) screen_set_sgr(ATTR_BLINK, 0); |
|
|
|
else if (n == SGR_OFF(SGR_BLINK)) screen_set_sgr(ATTR_BLINK, 0); |
|
|
|
else if (n == SGR_OFF(SGR_STRIKE)) screen_set_sgr(ATTR_STRIKE, 0); |
|
|
|
else if (n == SGR_OFF(SGR_STRIKE)) screen_set_sgr(ATTR_STRIKE, 0); |
|
|
|
else if (n == SGR_OFF(SGR_INVERSE)) screen_set_sgr_inverse(0); |
|
|
|
else if (n == SGR_OFF(SGR_INVERSE)) screen_set_sgr_inverse(0); |
|
|
|
// -- AIX bright colors --
|
|
|
|
else if (n == SGR_OFF(SGR_CONCEAL)) screen_set_sgr_conceal(0); |
|
|
|
else if (n >= SGR_FG_BRT_START && n <= SGR_FG_BRT_END) screen_set_fg((Color) ((n - SGR_FG_BRT_START) + 8)); // AIX bright fg
|
|
|
|
|
|
|
|
else if (n >= SGR_BG_BRT_START && n <= SGR_BG_BRT_END) screen_set_bg((Color) ((n - SGR_BG_BRT_START) + 8)); // AIX bright bg
|
|
|
|
|
|
|
|
else { |
|
|
|
else { |
|
|
|
ansi_noimpl("SGR %d", n); |
|
|
|
ansi_noimpl("SGR %d", n); |
|
|
|
} |
|
|
|
} |
|
|
|