diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/editor.cxx | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/test/editor.cxx b/test/editor.cxx index beef18be2..f9eafa9d7 100644 --- a/test/editor.cxx +++ b/test/editor.cxx @@ -66,12 +66,13 @@ Fl_Text_Buffer *stylebuf = 0; Fl_Text_Display::Style_Table_Entry styletable[] = { // Style table { FL_BLACK, FL_COURIER, TS }, // A - Plain - { FL_DARK_GREEN, FL_COURIER_ITALIC, TS }, // B - Line comments - { FL_DARK_GREEN, FL_COURIER_ITALIC, TS }, // C - Block comments + { FL_DARK_GREEN, FL_HELVETICA_ITALIC, TS }, // B - Line comments + { FL_DARK_GREEN, FL_HELVETICA_ITALIC, TS }, // C - Block comments { FL_BLUE, FL_COURIER, TS }, // D - Strings { 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 + { FL_BLUE, FL_COURIER_BOLD, TS }, // G - Keywords + { FL_MAGENTA, FL_HELVETICA, TS-2 } // H - Font height test }; const char *code_keywords[] = { // List of known C/C++ keywords... "and", @@ -200,6 +201,8 @@ style_parse(const char *text, if (length == 0) break; } else if (strncmp(text, "/*", 2) == 0) { current = 'C'; + } else if (strncmp(text, "[", 1) == 0) { + current = 'H'; } else if (strncmp(text, "\\\"", 2) == 0) { // Quoted quote... *style++ = current; @@ -261,6 +264,14 @@ style_parse(const char *text, current = 'A'; col += 2; continue; + } else if (current == 'H' && strncmp(text, "]", 1) == 0) { + // Close a font test style + *style++ = current; + text ++; + length --; + current = 'A'; + col += 1; + continue; } else if (current == 'D') { // Continuing in string... if (strncmp(text, "\\\"", 2) == 0) { @@ -793,7 +804,48 @@ Fl_Window* new_view() { int main(int argc, char **argv) { textbuf = new Fl_Text_Buffer; - textbuf->text("Rügenwälder Ruß."); + textbuf->text( + "void saveas_cb() {\n" + " Fl_Native_File_Chooser fnfc;\n" + " fnfc.title(\"Save File As?\");\n" + " fnfc.type(Fl_Native_File_Chooser::BROWSE_SAVE_FILE);\n" + " if ( fnfc.show() ) return;\n" + " save_file(fnfc.filename());\n" + "}\n\n" + "// Falsches Üben von Xylophonmusik quält jeden größeren Zwerg\n" + "// (= Wrongful practicing of xylophone music tortures every larger dwarf)\n" + "\n" + "// Zwölf Boxkämpfer jagten Eva quer über den Sylter Deich\n" + "// (= Twelve boxing fighters hunted Eva across the dike of Sylt)\n" + "\n" + "Heizöl/*rückstoß*/abdämpfung\n" + "(= fuel oil recoil absorber)\n" + "\n" + "Hiragana: //(Iroha)\n" + "\n" + "いろはにほへとちりぬるを\n" + "わかよたれそつねならむ\n" + "うゐのおくやまけふこえて\n" + "あさきゆめみしゑひもせす\n" + "\n" + "Katakana:\n" + "\n" + "イロハニホヘト チ/*リヌルヲ ワカヨタ*/レソ ツネナラム\n" + "ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン\n" + "\n" + "Right-to-left script does not work yet:\n" + "? דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה\n" + "\n" + "// いろはにほへと ちりぬるを わかよ\n" + "/* たれそ つねならむ うゐのおくやま */\n" + "けふこえて あさきゆめみし ゑひも\n" + "せす\n\n" + "Even colours and [sweet perfume] / Will eventually fade /\n" + "Even our world / Is not eternal /\n" + "The deep mountains of vanity / Cross them today /\n" + "And superficial dreams / Shall no longer delude you.\n" + "(from Iroha-uta)" + ); style_init(); Fl_Window* window = new_view(); |
