diff --git a/ChangeLog b/ChangeLog index 1c86893a..e9dcceb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,11 @@ src/filetypes.h, src/editor.c, data/filetype_extensions.conf, data/filetypes.po: Add new filetype 'Gettext translation file' (closes #2131985). + * src/highlighting.c, data/filetypes.perl: + Don't use hard-coded stylebits values for different lexers, query + the correct value from Scintilla and use it (this fixes a display + problem with Perl code like 'sub test()'). + Add missing styles for filetype Perl. 2008-09-27 Enrico Tröger diff --git a/data/filetypes.perl b/data/filetypes.perl index 34960c2b..f7bfe293 100644 --- a/data/filetypes.perl +++ b/data/filetypes.perl @@ -31,6 +31,13 @@ string_qx=0x000000;0xe0c0e0;false;false string_qr=0x105090;0xffffff;false;false string_qw=0x105090;0xffffff;false;false variable_indexer=0x000000;0xffffff;false;false +# not used +punctuation=0x000000;0xffffff;false;false +# obsolete: replaced by qq, qx, qr, qw +longquote=0x000000;0xffffff;false;false +sub_prototype=0x301010;0xffffff;false;true +format_ident=0xc000c0;0xffffff;true;false +format=0xc000c0;0xffffff;false;false [keywords] primary=NULL __FILE__ __LINE__ __PACKAGE__ __DATA__ __END__ AUTOLOAD BEGIN CORE DESTROY END EQ GE GT INIT LE LT NE CHECK abs accept alarm and atan2 bind binmode bless caller chdir chmod chomp chop chown chr chroot close closedir cmp connect continue cos crypt dbmclose dbmopen defined delete die do dump each else elsif endgrent endhostent endnetent endprotoent endpwent endservent eof eq eval exec exists exit exp fcntl fileno flock for foreach fork format formline ge getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt glob gmtime goto grep gt hex if index int ioctl join keys kill last lc lcfirst le length link listen local localtime lock log lstat lt m map mkdir msgctl msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack package pipe pop pos print printf prototype push q qq qr quotemeta qu qw qx rand read readdir readline readlink readpipe recv redo ref rename require reset return reverse rewinddir rindex rmdir s scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn while write x xor y diff --git a/src/highlighting.c b/src/highlighting.c index 719ad559..d1e2a117 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -433,7 +433,7 @@ static void styleset_common_init(gint ft_id, GKeyFile *config, GKeyFile *config_ } -static void styleset_common(ScintillaObject *sci, gint style_bits, filetype_id ft_id) +static void styleset_common(ScintillaObject *sci, filetype_id ft_id) { SSM(sci, SCI_STYLECLEARALL, 0, 0); @@ -571,8 +571,7 @@ static void styleset_common(ScintillaObject *sci, gint style_bits, filetype_id f if (common_style_set.styling[GCS_SELECTION].italic) SSM(sci, SCI_SETSELBACK, 1, invert(common_style_set.styling[GCS_SELECTION].background)); - SSM(sci, SCI_SETSTYLEBITS, style_bits, 0); - + SSM(sci, SCI_SETSTYLEBITS, SSM(sci, SCI_GETSTYLEBITSNEEDED, 0, 0), 0); SSM(sci, SCI_SETFOLDMARGINCOLOUR, 1, invert(common_style_set.styling[GCS_MARGIN_FOLDING].background)); /*SSM(sci, SCI_SETFOLDMARGINHICOLOUR, 1, invert(common_style_set.styling[GCS_MARGIN_FOLDING].background));*/ @@ -619,6 +618,8 @@ apply_filetype_properties(ScintillaObject *sci, gint lexer, filetype_id ft_id) SSM(sci, SCI_SETWHITESPACECHARS, 0, (sptr_t) whitespace_chars); SSM(sci, SCI_AUTOCSETMAXHEIGHT, editor_prefs.symbolcompletion_max_height, 0); + + styleset_common(sci, ft_id); } @@ -727,8 +728,6 @@ static void styleset_c(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_C; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_CPP, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_C].keywords[0]); @@ -771,8 +770,6 @@ static void styleset_cpp(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_CPP; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_CPP, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_CPP].keywords[0]); @@ -827,8 +824,6 @@ static void styleset_glsl(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_GLSL; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_CPP, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_GLSL].keywords[0]); @@ -879,8 +874,6 @@ static void styleset_cs(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_CS; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_CPP, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[ft_id].keywords[0]); @@ -927,8 +920,6 @@ static void styleset_pascal(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_PASCAL; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_PASCAL, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_PASCAL].keywords[0]); @@ -971,8 +962,6 @@ static void styleset_makefile(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_MAKE; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_MAKEFILE, ft_id); set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_MAKE, 0); @@ -1008,8 +997,6 @@ static void styleset_diff(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_DIFF; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_DIFF, ft_id); set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_DIFF, 0); @@ -1045,8 +1032,6 @@ static void styleset_latex(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_LATEX; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_LATEX, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_LATEX].keywords[0]); @@ -1074,8 +1059,6 @@ static void styleset_php(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_PHP; - styleset_common(sci, 7, ft_id); - apply_filetype_properties(sci, SCLEX_HTML, ft_id); SSM(sci, SCI_SETPROPERTY, (sptr_t) "phpscript.mode", (sptr_t) "1"); @@ -1099,8 +1082,6 @@ static void styleset_html(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_HTML; - styleset_common(sci, 7, ft_id); - apply_filetype_properties(sci, SCLEX_HTML, ft_id); /* use the same colouring for HTML; XML and so on */ @@ -1365,8 +1346,6 @@ static void styleset_java(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_JAVA; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_CPP, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_JAVA].keywords[0]); @@ -1380,7 +1359,7 @@ static void styleset_java(ScintillaObject *sci) static void styleset_perl_init(gint ft_id, GKeyFile *config, GKeyFile *config_home) { - new_style_array(GEANY_FILETYPES_PERL, 30); + new_style_array(GEANY_FILETYPES_PERL, 35); get_keyfile_hex(config, config_home, "styling", "default", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PERL].styling[0]); get_keyfile_hex(config, config_home, "styling", "error", "0xff0000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PERL].styling[1]); get_keyfile_style(config, config_home, "commentline", &gsd_comment, &style_sets[GEANY_FILETYPES_PERL].styling[2]); @@ -1411,6 +1390,12 @@ static void styleset_perl_init(gint ft_id, GKeyFile *config, GKeyFile *config_ho get_keyfile_hex(config, config_home, "styling", "string_qr", "0x105090", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PERL].styling[27]); get_keyfile_hex(config, config_home, "styling", "string_qw", "0x105090", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PERL].styling[28]); get_keyfile_hex(config, config_home, "styling", "variable_indexer", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PERL].styling[29]); + get_keyfile_hex(config, config_home, "styling", "punctuation", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PERL].styling[30]); + get_keyfile_hex(config, config_home, "styling", "longquote", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PERL].styling[31]); + get_keyfile_hex(config, config_home, "styling", "sub_prototype", "0x301010", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PERL].styling[32]); + get_keyfile_hex(config, config_home, "styling", "format_ident", "0xc000c0", "0xffffff", "true", &style_sets[GEANY_FILETYPES_PERL].styling[33]); + get_keyfile_hex(config, config_home, "styling", "format", "0xc000c0", "0xffffff", "false", &style_sets[GEANY_FILETYPES_PERL].styling[34]); + style_sets[GEANY_FILETYPES_PERL].keywords = g_new(gchar*, 2); get_keyfile_keywords(config, config_home, "keywords", "primary", GEANY_FILETYPES_PERL, 0, "\ @@ -1452,8 +1437,6 @@ static void styleset_perl(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_PERL; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_PERL, ft_id); SSM(sci, SCI_SETPROPERTY, (sptr_t) "styling.within.preprocessor", (sptr_t) "1"); @@ -1491,6 +1474,11 @@ static void styleset_perl(ScintillaObject *sci) set_sci_style(sci, SCE_PL_STRING_QR, GEANY_FILETYPES_PERL, 27); set_sci_style(sci, SCE_PL_STRING_QW, GEANY_FILETYPES_PERL, 28); set_sci_style(sci, SCE_PL_VARIABLE_INDEXER, GEANY_FILETYPES_PERL, 29); + set_sci_style(sci, SCE_PL_PUNCTUATION, GEANY_FILETYPES_PERL, 30); + set_sci_style(sci, SCE_PL_LONGQUOTE, GEANY_FILETYPES_PERL, 31); + set_sci_style(sci, SCE_PL_SUB_PROTOTYPE, GEANY_FILETYPES_PERL, 32); + set_sci_style(sci, SCE_PL_FORMAT_IDENT, GEANY_FILETYPES_PERL, 33); + set_sci_style(sci, SCE_PL_FORMAT, GEANY_FILETYPES_PERL, 34); } @@ -1528,8 +1516,6 @@ static void styleset_python(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_PYTHON; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_PYTHON, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_PYTHON].keywords[0]); @@ -1588,8 +1574,6 @@ static void styleset_r(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_R; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_R, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_R].keywords[0]); @@ -1662,8 +1646,6 @@ static void styleset_ruby(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_RUBY; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_RUBY, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_RUBY].keywords[0]); @@ -1738,8 +1720,6 @@ static void styleset_sh(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_SH; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_BASH, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_SH].keywords[0]); @@ -1766,8 +1746,6 @@ static void styleset_xml(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_XML; - styleset_common(sci, 7, ft_id); - apply_filetype_properties(sci, SCLEX_XML, ft_id); /* use the same colouring for HTML; XML and so on */ @@ -1877,8 +1855,6 @@ static void styleset_docbook(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_DOCBOOK; - styleset_common(sci, 7, ft_id); - apply_filetype_properties(sci, SCLEX_XML, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_DOCBOOK].keywords[0]); @@ -1926,14 +1902,10 @@ static void styleset_docbook(ScintillaObject *sci) static void styleset_none(ScintillaObject *sci) { - const filetype_id ft_id = GEANY_FILETYPES_NONE; - SSM(sci, SCI_SETLEXER, SCLEX_NULL, 0); set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_NONE, GCS_DEFAULT); - styleset_common(sci, 5, ft_id); - SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) common_style_set.wordchars); SSM(sci, SCI_SETWHITESPACECHARS, 0, (sptr_t) whitespace_chars); } @@ -1998,8 +1970,6 @@ static void styleset_css(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_CSS; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_CSS, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_CSS].keywords[0]); @@ -2051,8 +2021,6 @@ static void styleset_po(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_PO; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_PO, ft_id); set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_PO, 0); @@ -2089,8 +2057,6 @@ static void styleset_conf(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_CONF; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_PROPERTIES, ft_id); set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_CONF, 0); @@ -2137,8 +2103,6 @@ static void styleset_asm(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_ASM; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_ASM, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_ASM].keywords[0]); @@ -2200,8 +2164,6 @@ static void styleset_f77(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_F77; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_F77, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_F77].keywords[0]); @@ -2261,8 +2223,6 @@ static void styleset_fortran(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_FORTRAN; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_FORTRAN, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_FORTRAN].keywords[0]); @@ -2347,8 +2307,6 @@ static void styleset_sql(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_SQL; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_SQL, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_SQL].keywords[0]); @@ -2407,8 +2365,6 @@ static void styleset_haskell(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_HASKELL; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_HASKELL, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_HASKELL].keywords[0]); @@ -2471,8 +2427,6 @@ static void styleset_caml(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_CAML; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_CAML, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_CAML].keywords[0]); @@ -2530,8 +2484,6 @@ static void styleset_oms(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_OMS; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_OMS, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_OMS].keywords[0]); @@ -2588,8 +2540,6 @@ static void styleset_tcl(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_TCL; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_TCL, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_TCL].keywords[0]); @@ -2667,8 +2617,6 @@ static void styleset_d(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_D; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_D, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_D].keywords[0]); @@ -2718,8 +2666,6 @@ static void styleset_ferite(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_FERITE; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_CPP, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_FERITE].keywords[0]); @@ -2790,8 +2736,6 @@ static void styleset_vhdl(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_VHDL; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_VHDL, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_VHDL].keywords[0]); @@ -2851,8 +2795,6 @@ static void styleset_js(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_JS; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_CPP, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_JS].keywords[0]); @@ -2933,8 +2875,6 @@ static void styleset_lua(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_LUA; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_LUA, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_LUA].keywords[0]); @@ -3022,8 +2962,6 @@ static void styleset_basic(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_BASIC; - styleset_common(sci, 5, ft_id); - apply_filetype_properties(sci, SCLEX_FREEBASIC, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_BASIC].keywords[0]); @@ -3088,8 +3026,6 @@ static void styleset_haxe(ScintillaObject *sci) { const filetype_id ft_id = GEANY_FILETYPES_HAXE; - styleset_common(sci, 5,ft_id); - apply_filetype_properties(sci, SCLEX_CPP, ft_id); SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_HAXE].keywords[0]);