From cdb51045dda7076be33147cc8e9138035ad9b97e Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 27 Jan 2022 23:50:06 +0100 Subject: Background color attribute for Fl_Text_Display. (#378) * Background color attribute for Fl_Text_Display. * Adding attributes. * Avoid clipping horizontal * Fl_Text_Display underlining. * Better line positions * Typos, testing. * Documentation. --- test/editor.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/editor.cxx b/test/editor.cxx index eb45de7aa..478bd3ebe 100644 --- a/test/editor.cxx +++ b/test/editor.cxx @@ -57,6 +57,15 @@ const int line_num_width = 75; Fl_Text_Buffer *stylebuf = 0; Fl_Text_Display::Style_Table_Entry styletable[] = { // Style table +#ifdef TESTING_ATTRIBUTES + { FL_BLACK, FL_COURIER, TS }, // A - Plain + { FL_DARK_GREEN, FL_HELVETICA_ITALIC, TS, Fl_Text_Display::ATTR_BGCOLOR, FL_LIGHT2 }, // B - Line comments + { FL_DARK_GREEN, FL_HELVETICA_ITALIC, TS, Fl_Text_Display::ATTR_BGCOLOR_EXT, FL_LIGHT2 }, // C - Block comments + { FL_BLUE, FL_COURIER, TS, Fl_Text_Display::ATTR_UNDERLINE }, // D - Strings + { FL_DARK_RED, FL_COURIER, TS, Fl_Text_Display::ATTR_GRAMMAR }, // E - Directives + { FL_DARK_RED, FL_COURIER_BOLD, TS, Fl_Text_Display::ATTR_STRIKE_THROUGH }, // F - Types + { FL_BLUE, FL_COURIER_BOLD, TS, Fl_Text_Display::ATTR_SPELLING }, // G - Keywords +#else { FL_BLACK, FL_COURIER, TS }, // A - Plain { FL_DARK_GREEN, FL_HELVETICA_ITALIC, TS }, // B - Line comments { FL_DARK_GREEN, FL_HELVETICA_ITALIC, TS }, // C - Block comments @@ -64,6 +73,7 @@ Fl_Text_Display::Style_Table_Entry { FL_DARK_RED, FL_COURIER, TS }, // E - Directives { FL_DARK_RED, FL_COURIER_BOLD, TS }, // F - Types { FL_BLUE, FL_COURIER_BOLD, TS }, // G - Keywords +#endif }; const char *code_keywords[] = { // List of known C/C++ keywords... "and", @@ -188,7 +198,6 @@ style_parse(const char *text, } else if (strncmp(text, "//", 2) == 0) { current = 'B'; for (; length > 0 && *text != '\n'; length --, text ++) *style++ = 'B'; - if (length == 0) break; } else if (strncmp(text, "/*", 2) == 0) { current = 'C'; -- cgit v1.2.3