From 110f461cf5615b4caf297e2fea636b13f535c2c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Mon, 31 Jul 2017 02:59:13 +0200 Subject: [PATCH] bold works !! --- html_orig/css/app.css | 3 ++- html_orig/sass/pages/_term.scss | 3 +++ user/ansi_parser_callbacks.c | 11 ++++++----- user/screen.c | 13 +++++++++++-- user/screen.h | 2 +- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/html_orig/css/app.css b/html_orig/css/app.css index 88ee2fe..e718b5d 100644 --- a/html_orig/css/app.css +++ b/html_orig/css/app.css @@ -1092,7 +1092,8 @@ form span.required { body.term #content { padding-left: 0; - padding-right: 0; } + padding-right: 0; + transition: opacity 0.25s ease-in; } body.term #content h1 { font-size: 1.80203em; } @media screen and (max-width: 544px) { diff --git a/html_orig/sass/pages/_term.scss b/html_orig/sass/pages/_term.scss index c058bfe..8152eb1 100755 --- a/html_orig/sass/pages/_term.scss +++ b/html_orig/sass/pages/_term.scss @@ -9,6 +9,9 @@ body.term { font-size: fsize(3); } } + + // longer duration to load everything in background nicely + transition: opacity 0.25s ease-in; } #screen { diff --git a/user/ansi_parser_callbacks.c b/user/ansi_parser_callbacks.c index 7ee8e0c..5e4b1bc 100644 --- a/user/ansi_parser_callbacks.c +++ b/user/ansi_parser_callbacks.c @@ -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 } diff --git a/user/screen.c b/user/screen.c index 240080d..74f42fa 100644 --- a/user/screen.c +++ b/user/screen.c @@ -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 diff --git a/user/screen.h b/user/screen.h index 6bea069..7f03e9a 100644 --- a/user/screen.h +++ b/user/screen.h @@ -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);