backend support for SGR overline, bit 7 of attrib byte

http-comm
Ondřej Hruška 7 years ago
parent 74c7628474
commit 384372e6c8
  1. 20
      user/apars_csi.c
  2. 1
      user/screen.h
  3. 11
      user/sgr.h

@ -552,7 +552,7 @@ do_csi_sgr(CSI_Data *opts)
else if (n == SGR_FG_256 || n == SGR_BG_256) { else if (n == SGR_FG_256 || n == SGR_BG_256) {
if (i < count-2) { if (i < count-2) {
if (opts->n[i + 1] == 5) { if (opts->n[i + 1] == 5) {
int color = opts->n[i + 2]; u16 color = (u16) opts->n[i + 2];
bool fg = n == SGR_FG_256; bool fg = n == SGR_FG_256;
if (fg) { if (fg) {
screen_set_fg_ext(color); screen_set_fg_ext(color);
@ -582,15 +582,17 @@ do_csi_sgr(CSI_Data *opts)
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); else if (n == SGR_CONCEAL) screen_set_sgr_conceal(1);
else if (n == SGR_OVERLINE) screen_set_sgr(ATTR_OVERLINE, 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_NO_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_NO_BOLD_FAINT) screen_set_sgr(ATTR_FAINT | ATTR_BOLD, 0); // "normal"
else if (n == SGR_OFF(SGR_ITALIC)) screen_set_sgr(ATTR_ITALIC | ATTR_FRAKTUR, 0); // there is no dedicated OFF code for Fraktur else if (n == SGR_NO_ITALIC_FRACTUR) screen_set_sgr(ATTR_ITALIC | ATTR_FRAKTUR, 0); // there is no dedicated OFF code for Fraktur
else if (n == SGR_OFF(SGR_UNDERLINE)) screen_set_sgr(ATTR_UNDERLINE, 0); else if (n == SGR_NO_UNDERLINE) screen_set_sgr(ATTR_UNDERLINE, 0);
else if (n == SGR_OFF(SGR_BLINK)) screen_set_sgr(ATTR_BLINK, 0); else if (n == SGR_NO_BLINK) screen_set_sgr(ATTR_BLINK, 0);
else if (n == SGR_OFF(SGR_STRIKE)) screen_set_sgr(ATTR_STRIKE, 0); else if (n == SGR_NO_STRIKE) screen_set_sgr(ATTR_STRIKE, 0);
else if (n == SGR_OFF(SGR_INVERSE)) screen_set_sgr_inverse(0); else if (n == SGR_NO_INVERSE) screen_set_sgr_inverse(0);
else if (n == SGR_OFF(SGR_CONCEAL)) screen_set_sgr_conceal(0); else if (n == SGR_NO_CONCEAL) screen_set_sgr_conceal(0);
else if (n == SGR_NO_OVERLINE) screen_set_sgr(ATTR_OVERLINE, 0);
else { else {
ansi_noimpl("SGR %d", n); ansi_noimpl("SGR %d", n);
} }

@ -230,6 +230,7 @@ typedef uint8_t Color; // 0-16
#define ATTR_BLINK (1<<4) #define ATTR_BLINK (1<<4)
#define ATTR_FRAKTUR (1<<5) #define ATTR_FRAKTUR (1<<5)
#define ATTR_STRIKE (1<<6) #define ATTR_STRIKE (1<<6)
#define ATTR_OVERLINE (1<<7)
/** Set cursor foreground color */ /** Set cursor foreground color */
void screen_set_fg(Color color); void screen_set_fg(Color color);

@ -17,6 +17,17 @@ enum SGR_CODES {
SGR_CONCEAL = 8, SGR_CONCEAL = 8,
SGR_STRIKE = 9, SGR_STRIKE = 9,
SGR_FRAKTUR = 20, SGR_FRAKTUR = 20,
SGR_OVERLINE = 53,
SGR_NO_BOLD = 21,
SGR_NO_BOLD_FAINT = 22,
SGR_NO_ITALIC_FRACTUR = 23,
SGR_NO_UNDERLINE = 24,
SGR_NO_BLINK = 25,
SGR_NO_INVERSE = 27,
SGR_NO_CONCEAL = 28,
SGR_NO_STRIKE = 29,
SGR_NO_OVERLINE = 55,
SGR_FG_START = 30, SGR_FG_START = 30,
SGR_FG_END = 37, SGR_FG_END = 37,

Loading…
Cancel
Save