bold works !!

This commit is contained in:
2017-07-31 02:59:13 +02:00
parent 3ae1451821
commit 110f461cf5
5 changed files with 23 additions and 9 deletions
+6 -5
View File
@@ -222,16 +222,17 @@ apars_handle_CSI(char leadchar, int *params, char keychar)
int n = params[i];
if (i == 0 && n == 0) { // reset SGR
screen_reset_cursor();
screen_reset_cursor(); // resets colors, inverse and bold.
break; // cannot combine reset with others
}
else if (n >= 30 && n <= 37) screen_set_fg(n-30); // ANSI normal fg
else if (n >= 40 && n <= 47) screen_set_bg(n-40); // ANSI normal bg
else if (n == 39) screen_set_fg(7); // default fg
else if (n == 49) screen_set_bg(0); // default bg
else if (n == 7) screen_inverse(1); // inverse
else if (n == 27) screen_inverse(0); // positive
else if (n == 1) screen_set_bright_fg(); // ANSI bold = bright fg
else if (n == 49) screen_set_bg(false); // default bg
else if (n == 7) screen_inverse(true); // inverse
else if (n == 27) screen_inverse(false); // positive
else if (n == 1) screen_set_bold(true); // ANSI bold = bright fg
else if (n == 21 || n == 22) screen_set_bold(false); // ANSI bold = bright fg
else if (n >= 90 && n <= 97) screen_set_fg(n-90+8); // AIX bright fg
else if (n >= 100 && n <= 107) screen_set_bg(n-100+8); // AIX bright bg
}
+11 -2
View File
@@ -116,6 +116,7 @@ clear_range(unsigned int from, unsigned int to)
screen[i].c[3] = 0;
screen[i].fg = fg;
screen[i].bg = bg;
screen[i].bold = false;
}
}
@@ -502,11 +503,18 @@ screen_inverse(bool inverse)
* This relates to the '1' SGR command which originally means
* "bold font". We interpret that as "Bright", similar to other
* terminal emulators.
*
* Note that the bright colors can be used without bold using the 90+ codes
*/
void ICACHE_FLASH_ATTR
screen_set_bright_fg(void)
screen_set_bold(bool bold)
{
cursor.fg = (Color) ((cursor.fg % 8) + 8);
if (!bold) {
cursor.fg = (Color) (cursor.fg % 8);
} else {
cursor.fg = (Color) ((cursor.fg % 8) + 8); // change anything to the bright colors
}
cursor.bold = bold;
}
//endregion
@@ -591,6 +599,7 @@ screen_putchar(const char *ch)
c->fg = cursor.fg;
c->bg = cursor.bg;
}
c->bold = cursor.bold;
cursor.x++;
// X wrap
+1 -1
View File
@@ -170,7 +170,7 @@ void screen_set_fg(Color color);
void screen_set_bg(Color color);
/** make foreground bright */
void screen_set_bright_fg(void);
void screen_set_bold(bool bold);
/** Set cursor foreground and background color */
void screen_set_colors(Color fg, Color bg);