From b1b4a4e157d885325a016b32d522e3565eb5a0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Fri, 1 Sep 2006 17:07:49 +0000 Subject: [PATCH] Split filetype PHP/HTML into PHP and HTML. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@779 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 4 ++ TODO | 9 +++-- data/filetype_extensions.conf | 4 +- data/filetypes.html | 31 +++++++++++++++ src/callbacks.c | 6 +++ src/filetypes.c | 43 ++++++++++++++++----- src/filetypes.h | 2 - src/highlighting.c | 61 ++++++++++++++++++++++++----- src/highlighting.h | 2 + src/keybindings.c | 2 +- src/msgwindow.c | 19 ++++++++- src/sci_cb.c | 73 ++++++++++++++++++++++------------- src/sci_cb.h | 10 ++--- 13 files changed, 206 insertions(+), 60 deletions(-) create mode 100644 data/filetypes.html diff --git a/ChangeLog b/ChangeLog index bfc1d0aa..f36878bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ * src/document.c, src/dialogs.c, src/prefs.c, src/callbacks.c, src/interface.c, geany.glade: Fixed some typos. + * src/filetypes.c, src/highlighting.c, src/keybindings.c, + src/sci_cb.c, data/filetypes.html, data/filetype_extensions.conf, + src/callbacks.c, src/msgwindow.c: + Split filetype PHP/HTML into PHP and HTML. 2006-09-01 Frank Lanitz diff --git a/TODO b/TODO index 3bb7d39e..9c492817 100644 --- a/TODO +++ b/TODO @@ -5,19 +5,20 @@ TODO List: Geany 0.8 or later: + o fix problems when loading global.tags and other tags files are + already loaded o Go to xxx - definable command o documentation: list and explain filetype modes - o user-definable auto completion structs o documentation: preferences - o save build includes & arguments - o separate filetype for HTML + o user-definable auto completion structs + o save build includes & arguments (->project management) o don't override Scintilla keybindings by default o allow use of custom global tags files o common default highlighting all in one config file + o project management o (DBUS) o (startup notification) o (indent wrapped lines - Scintilla issue) o (inverting highlighting by selection - Scintilla issue) - o (project management) o (folder tree in the sidebar) o (improved Windows support) diff --git a/data/filetype_extensions.conf b/data/filetype_extensions.conf index 86e24ed6..bdf0cfe4 100644 --- a/data/filetype_extensions.conf +++ b/data/filetype_extensions.conf @@ -12,7 +12,7 @@ Fortran=*.f;*.f77;*.f90;*.f95;*.for;*.ftn; Ferite=*.fe; CAML=*.ml;*.mli; Perl=*.pl;*.perl;*.pm; -PHP=*.php;*.php3;*.php4;*.php5;*.html;*.htm; +PHP=*.php;*.php3;*.php4;*.php5;*.phtml; Python=*.py;*.pyw; Ruby=*.rb;*.rhtml; Tcl=*.tcl;*.tk;*.wish; @@ -20,6 +20,7 @@ Sh=*.sh;configure;configure.in;configure.in.in;configure.ac;*.ksh;*.zsh; Make=*.mak;*.mk;Makefile*;makefile*; XML=*.xml;*.sgml; Docbook=*.docbook; +HTML=*.htm;*.html;*.shtml;*.hta;*.htd;*.htt;*.cfm; CSS=*.css; SQL=*.sql; LaTeX=*.tex;*.sty;*.idx; @@ -27,3 +28,4 @@ O-Matrix=*.oms; Conf=*.conf;*.ini;config;*rc;*.cfg; Diff=*.diff;*.patch; None=*; + diff --git a/data/filetypes.html b/data/filetypes.html new file mode 100644 index 00000000..e0b3dbfb --- /dev/null +++ b/data/filetypes.html @@ -0,0 +1,31 @@ +# For complete documentation of this file, please see Geany's main documentation +[styling] +# styling for PHP/HTML is done in filetypes.xml + + +[settings] +# the following characters are these which a "word" can contains, see documentation +wordchars=_#&abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 + +# if only single comment char is supported like # in this file, leave comment_close blank +# these comments are used for PHP, the comments used in HTML are in filetypes.xml +comment_open= + +# set to false if a comment character/string should start at column 0 of a line, true uses any +# indention of the line, e.g. setting to true causes the following on pressing CTRL+d + #command_example(); +# setting to false would generate this +# command_example(); +# This setting works only for single line comments +comment_use_indent=true + +[build_settings] +# %f will be replaced by the complete filename +# %e will be replaced by the filename without extension +# (use only one of it at one time) +# use a syntax checker and ignore the formatted output +compiler=tidy %f >/dev/null + +# the file will be opened with the default browser which can be set in the preferences dialog +run_cmd=builtin diff --git a/src/callbacks.c b/src/callbacks.c index 51236b8a..99ea8d14 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -1716,6 +1716,12 @@ on_build_execute_activate (GtkMenuItem *menuitem, msgwin_status_add(_("Failed to execute the view program")); } } + else if (doc_list[idx].file_type->id == GEANY_FILETYPES_HTML) + { + gchar *uri = g_strconcat("file:///", g_path_skip_root(doc_list[idx].file_name), NULL); + utils_start_browser(uri); + g_free(uri); + } else { // save the file only if the run command uses it diff --git a/src/filetypes.c b/src/filetypes.c index b5ef0458..1dd24708 100644 --- a/src/filetypes.c +++ b/src/filetypes.c @@ -60,8 +60,8 @@ enum FILETYPE_UID_D, // 21 FILETYPE_UID_FORTRAN, // 22 FILETYPE_UID_DIFF, // 23 - FILETYPE_UID_FERITE // 24 - //FILETYPE_UID_HTML, // 25 + FILETYPE_UID_FERITE, // 24 + FILETYPE_UID_HTML // 25 }; @@ -100,9 +100,9 @@ filetype *filetypes_get_from_uid(gint uid) case FILETYPE_UID_ALL: return filetypes[GEANY_FILETYPES_ALL]; case FILETYPE_UID_D: return filetypes[GEANY_FILETYPES_D]; case FILETYPE_UID_FORTRAN: return filetypes[GEANY_FILETYPES_FORTRAN]; - case FILETYPE_UID_DIFF: return filetypes[GEANY_FILETYPES_DIFF]; + case FILETYPE_UID_DIFF: return filetypes[GEANY_FILETYPES_DIFF]; case FILETYPE_UID_FERITE: return filetypes[GEANY_FILETYPES_FERITE]; - //case FILETYPE_UID_HTML: return filetypes[GEANY_FILETYPES_HTML]; + case FILETYPE_UID_HTML: return filetypes[GEANY_FILETYPES_HTML]; default: return NULL; } } @@ -322,16 +322,15 @@ void filetypes_init_types(void) filetypes[GEANY_FILETYPES_PHP]->lang = 6; filetypes[GEANY_FILETYPES_PHP]->name = g_strdup("PHP"); filetypes[GEANY_FILETYPES_PHP]->has_tags = TRUE; - filetypes[GEANY_FILETYPES_PHP]->title = g_strdup(_("PHP / HTML source file")); + filetypes[GEANY_FILETYPES_PHP]->title = g_strdup(_("PHP source file")); filetypes[GEANY_FILETYPES_PHP]->extension = g_strdup("php"); - filetypes[GEANY_FILETYPES_PHP]->pattern = g_new0(gchar*, 7); + filetypes[GEANY_FILETYPES_PHP]->pattern = g_new0(gchar*, 6); filetypes[GEANY_FILETYPES_PHP]->pattern[0] = g_strdup("*.php"); filetypes[GEANY_FILETYPES_PHP]->pattern[1] = g_strdup("*.php3"); filetypes[GEANY_FILETYPES_PHP]->pattern[2] = g_strdup("*.php4"); filetypes[GEANY_FILETYPES_PHP]->pattern[3] = g_strdup("*.php5"); - filetypes[GEANY_FILETYPES_PHP]->pattern[4] = g_strdup("*.html"); - filetypes[GEANY_FILETYPES_PHP]->pattern[5] = g_strdup("*.htm"); - filetypes[GEANY_FILETYPES_PHP]->pattern[6] = NULL; + filetypes[GEANY_FILETYPES_PHP]->pattern[4] = g_strdup("*.phtml"); + filetypes[GEANY_FILETYPES_PHP]->pattern[5] = NULL; filetypes[GEANY_FILETYPES_PHP]->style_func_ptr = styleset_php; filetypes[GEANY_FILETYPES_PHP]->comment_open = g_strdup("//"); filetypes[GEANY_FILETYPES_PHP]->comment_close = NULL; @@ -504,6 +503,32 @@ void filetypes_init_types(void) filetypes_init_build_programs(filetypes[GEANY_FILETYPES_DOCBOOK]); filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_DOCBOOK]->title, filetypes[GEANY_FILETYPES_DOCBOOK]); +#define HTML + filetypes[GEANY_FILETYPES_HTML] = g_new0(filetype, 1); + filetypes[GEANY_FILETYPES_HTML]->id = GEANY_FILETYPES_HTML; + filetypes[GEANY_FILETYPES_HTML]->uid = FILETYPE_UID_HTML; + filetypes[GEANY_FILETYPES_HTML]->item = NULL; + filetypes[GEANY_FILETYPES_HTML]->lang = -2; + filetypes[GEANY_FILETYPES_HTML]->name = g_strdup("HTML"); + filetypes[GEANY_FILETYPES_HTML]->has_tags = FALSE; + filetypes[GEANY_FILETYPES_HTML]->title = g_strdup(_("HTML source file")); + filetypes[GEANY_FILETYPES_HTML]->extension = g_strdup("html"); + filetypes[GEANY_FILETYPES_HTML]->pattern = g_new0(gchar*, 8); + filetypes[GEANY_FILETYPES_HTML]->pattern[0] = g_strdup("*.htm"); + filetypes[GEANY_FILETYPES_HTML]->pattern[1] = g_strdup("*.html"); + filetypes[GEANY_FILETYPES_HTML]->pattern[2] = g_strdup("*.shtml"); + filetypes[GEANY_FILETYPES_HTML]->pattern[3] = g_strdup("*.hta"); + filetypes[GEANY_FILETYPES_HTML]->pattern[4] = g_strdup("*.htd"); + filetypes[GEANY_FILETYPES_HTML]->pattern[5] = g_strdup("*.htt"); + filetypes[GEANY_FILETYPES_HTML]->pattern[6] = g_strdup("*.cfm"); + filetypes[GEANY_FILETYPES_HTML]->pattern[7] = NULL; + filetypes[GEANY_FILETYPES_HTML]->style_func_ptr = styleset_html; + filetypes[GEANY_FILETYPES_HTML]->comment_open = g_strdup(""); + filetypes_init_build_programs(filetypes[GEANY_FILETYPES_HTML]); + filetypes_create_menu_item(filetype_menu, filetypes[GEANY_FILETYPES_HTML]->title, filetypes[GEANY_FILETYPES_HTML]); + filetypes_create_newmenu_item(template_menu, filetypes[GEANY_FILETYPES_HTML]->title, filetypes[GEANY_FILETYPES_HTML]); + #define CSS filetypes[GEANY_FILETYPES_CSS] = g_new0(filetype, 1); filetypes[GEANY_FILETYPES_CSS]->id = GEANY_FILETYPES_CSS; diff --git a/src/filetypes.h b/src/filetypes.h index 51d8f987..2624c772 100644 --- a/src/filetypes.h +++ b/src/filetypes.h @@ -52,9 +52,7 @@ enum GEANY_FILETYPES_MAKE, GEANY_FILETYPES_XML, GEANY_FILETYPES_DOCBOOK, -/* GEANY_FILETYPES_HTML, -*/ GEANY_FILETYPES_CSS, GEANY_FILETYPES_SQL, GEANY_FILETYPES_LATEX, diff --git a/src/highlighting.c b/src/highlighting.c index b9cb67a5..c8816e89 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -864,7 +864,7 @@ static void styleset_php_init(void) types[GEANY_FILETYPES_PHP] = g_new(style_set, 1); types[GEANY_FILETYPES_PHP]->keywords = NULL; - styleset_get_wordchars(config, config_home, GEANY_FILETYPES_PHP, GEANY_WORDCHARS"$"); + styleset_get_wordchars(config, config_home, GEANY_FILETYPES_PHP, GEANY_WORDCHARS); filetypes_get_config(config, config_home, GEANY_FILETYPES_PHP); // load global tags file for PHP autocompletion @@ -876,14 +876,6 @@ static void styleset_php_init(void) global_php_tags_loaded = TRUE; g_free(file); } - // load global tags file for HTML entities autocompletion - if (! app->ignore_global_tags && ! global_html_tags_loaded) - { - gchar *file = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "html_entities.tags", NULL); - html_entities = utils_read_file_in_array(file); - global_html_tags_loaded = TRUE; - g_free(file); - } g_key_file_free(config); g_key_file_free(config_home); @@ -903,13 +895,62 @@ void styleset_php(ScintillaObject *sci) SSM(sci, SCI_AUTOCSETMAXHEIGHT, app->autocompletion_max_height, 0); - // use the same colouring for HTML; XML and so on + // use the same colouring as for XML styleset_markup(sci); SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_PHP]->wordchars); } +static void styleset_html_init(void) +{ + GKeyFile *config = g_key_file_new(); + GKeyFile *config_home = g_key_file_new(); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.html", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.html", NULL); + + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); + g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL); + + types[GEANY_FILETYPES_HTML] = g_new(style_set, 1); + types[GEANY_FILETYPES_HTML]->keywords = NULL; + + styleset_get_wordchars(config, config_home, GEANY_FILETYPES_HTML, GEANY_WORDCHARS); + filetypes_get_config(config, config_home, GEANY_FILETYPES_HTML); + + // load global tags file for HTML entities autocompletion + if (! app->ignore_global_tags && ! global_html_tags_loaded) + { + gchar *file = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "html_entities.tags", NULL); + html_entities = utils_read_file_in_array(file); + global_html_tags_loaded = TRUE; + g_free(file); + } + + g_key_file_free(config); + g_key_file_free(config_home); + g_free(f0); + g_free(f); +} + + +void styleset_html(ScintillaObject *sci) +{ + if (types[GEANY_FILETYPES_HTML] == NULL) styleset_html_init(); + + styleset_common(sci, 7); + + SSM(sci, SCI_SETLEXER, SCLEX_HTML, 0); + + SSM(sci, SCI_AUTOCSETMAXHEIGHT, app->autocompletion_max_height, 0); + + // use the same colouring for HTML; XML and so on + styleset_markup(sci); + + SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) types[GEANY_FILETYPES_HTML]->wordchars); +} + + static void styleset_markup_init(void) { GKeyFile *config = g_key_file_new(); diff --git a/src/highlighting.h b/src/highlighting.h index f5c1e3a0..e9031b17 100644 --- a/src/highlighting.h +++ b/src/highlighting.h @@ -54,6 +54,8 @@ void styleset_latex(ScintillaObject *sci); void styleset_php(ScintillaObject *sci); +void styleset_html(ScintillaObject *sci); + void styleset_java(ScintillaObject *sci); void styleset_pascal(ScintillaObject *sci); diff --git a/src/keybindings.c b/src/keybindings.c index 92c9f04f..54b1bfbc 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -735,7 +735,7 @@ static void cb_func_edit_calltip(void) { gint idx = document_get_cur_idx(); if (idx == -1 || ! doc_list[idx].is_valid) return; - sci_cb_show_calltip(doc_list[idx].sci, -1, idx); + sci_cb_show_calltip(idx, -1); } static void cb_func_edit_macrolist(void) diff --git a/src/msgwindow.c b/src/msgwindow.c index 0b266969..82c634ae 100644 --- a/src/msgwindow.c +++ b/src/msgwindow.c @@ -435,7 +435,15 @@ void msgwin_parse_compiler_error_line(const gchar *string, gchar **filename, gin } break; } - + case GEANY_FILETYPES_HTML: + { + // line 78 column 7 - Warning: missing '>' for end of tag + pattern = " "; + field_min_len = 4; + field_idx_line = 1; + field_idx_file = -1; + break; + } default: return; } @@ -457,6 +465,15 @@ void msgwin_parse_compiler_error_line(const gchar *string, gchar **filename, gin return; } + // let's stop here if there is no filename in the error message + if (field_idx_file == -1) + { + // we have no filename in the error message, so take the current one and hope it's correct + *filename = g_strdup(doc_list[document_get_cur_idx()].file_name); + g_strfreev(fields); + return; + } + // skip some characters at the beginning of the filename, at the moment only "./" // can be extended if other "trash" is known if (strncmp(fields[field_idx_file], "./", 2) == 0) skip_dot_slash = 2; diff --git a/src/sci_cb.c b/src/sci_cb.c index 760c4fde..f29ec971 100644 --- a/src/sci_cb.c +++ b/src/sci_cb.c @@ -155,7 +155,7 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer } case '(': { // show calltips - sci_cb_show_calltip(sci, pos, idx); + sci_cb_show_calltip(idx, pos); break; } case ')': @@ -171,19 +171,19 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer } case ' ': { // if and for autocompletion - if (app->pref_editor_auto_complete_constructs) sci_cb_auto_forif(sci, pos, idx); + if (app->pref_editor_auto_complete_constructs) sci_cb_auto_forif(idx, pos); break; } case '[': case '{': { // Tex auto-closing sci_cb_auto_close_bracket(sci, pos, nt->ch); // Tex auto-closing - sci_cb_show_calltip(sci, pos, idx); + sci_cb_show_calltip(idx, pos); break; } case '}': { // closing bracket handling - if (doc_list[idx].use_auto_indention) sci_cb_close_block(sci, pos - 1); + if (doc_list[idx].use_auto_indention) sci_cb_close_block(idx, pos - 1); break; } default: sci_cb_start_auto_complete(idx, pos, FALSE); @@ -274,7 +274,7 @@ static void on_new_line_added(ScintillaObject *sci, gint idx) } // " * " auto completion in multiline C/C++ comments sci_cb_auto_multiline(sci, pos); - if (app->pref_editor_auto_complete_constructs) sci_cb_auto_latex(sci, pos, idx); + if (app->pref_editor_auto_complete_constructs) sci_cb_auto_latex(idx, pos); } @@ -372,22 +372,29 @@ static gint brace_match(ScintillaObject *sci, gint pos) } -void sci_cb_close_block(ScintillaObject *sci, gint pos) +void sci_cb_close_block(gint idx, gint pos) { gint x = 0, cnt = 0; - gint start_brace = brace_match(sci, pos); - gint line = sci_get_line_from_position(sci, pos); - gint line_start = sci_get_position_from_line(sci, line); - gint line_len = sci_get_line_length(sci, line); - // set eol_char_len to 0 if on last line, because there is no EOL char - gint eol_char_len = (line == (SSM(sci, SCI_GETLINECOUNT, 0, 0) - 1)) ? 0 : - utils_get_eol_char_len(document_find_by_sci(sci)); - gint lexer = SSM(sci, SCI_GETLEXER, 0, 0); + gint start_brace, line, line_start, line_len, eol_char_len, lexer; gchar *text, *line_buf; + ScintillaObject *sci; + if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL) return; + + sci = doc_list[idx].sci; + + lexer = SSM(sci, SCI_GETLEXER, 0, 0); if (lexer != SCLEX_CPP && lexer != SCLEX_HTML && lexer != SCLEX_PASCAL && lexer != SCLEX_BASH) return; + start_brace = brace_match(sci, pos); + line = sci_get_line_from_position(sci, pos); + line_start = sci_get_position_from_line(sci, line); + line_len = sci_get_line_length(sci, line); + // set eol_char_len to 0 if on last line, because there is no EOL char + eol_char_len = (line == (SSM(sci, SCI_GETLINECOUNT, 0, 0) - 1)) ? 0 : + utils_get_eol_char_len(document_find_by_sci(sci)); + // check that the line is empty, to not kill text in the line line_buf = g_malloc(line_len + 1); sci_get_line(sci, line, line_buf); @@ -440,19 +447,20 @@ void sci_cb_find_current_word(ScintillaObject *sci, gint pos, gchar *word, size_ } -gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos, gint idx) +gboolean sci_cb_show_calltip(gint idx, gint pos) { - gint orig_pos = pos; //the position for the calltip + gint orig_pos = pos; // the position for the calltip gint lexer; gint style; gchar word[GEANY_MAX_WORD_LENGTH]; TMTag *tag; const GPtrArray *tags; + ScintillaObject *sci; - if (sci == NULL) return FALSE; + if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL) return FALSE; + sci = doc_list[idx].sci; lexer = SSM(sci, SCI_GETLEXER, 0, 0); - if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL) return FALSE; word[0] = '\0'; if (pos == -1) @@ -571,7 +579,7 @@ gboolean sci_cb_start_auto_complete(gint idx, gint pos, gboolean force) ScintillaObject *sci; gboolean ret = FALSE; - if (idx < 0 || ! doc_list[idx].is_valid || doc_list[idx].sci == NULL) return FALSE; + if (idx < 0 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL) return FALSE; sci = doc_list[idx].sci; line = sci_get_line_from_position(sci, pos); @@ -612,8 +620,13 @@ gboolean sci_cb_start_auto_complete(gint idx, gint pos, gboolean force) } -void sci_cb_auto_latex(ScintillaObject *sci, gint pos, gint idx) +void sci_cb_auto_latex(gint idx, gint pos) { + ScintillaObject *sci; + + if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL) return; + sci = doc_list[idx].sci; + if (sci_get_char_at(sci, pos - 2) == '}') { gchar *eol, *buf, *construct; @@ -685,23 +698,29 @@ void sci_cb_auto_latex(ScintillaObject *sci, gint pos, gint idx) } -void sci_cb_auto_forif(ScintillaObject *sci, gint pos, gint idx) +void sci_cb_auto_forif(gint idx, gint pos) { static gchar buf[16]; gchar *eol; gchar *construct; gint lexer, style; gint i; + ScintillaObject *sci; - if (sci == NULL || idx == -1 || ! doc_list[idx].is_valid) return; + if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL) return; + sci = doc_list[idx].sci; lexer = SSM(sci, SCI_GETLEXER, 0, 0); style = SSM(sci, SCI_GETSTYLEAT, pos - 2, 0); // only for C, C++, Java, Perl and PHP - if (lexer != SCLEX_CPP && - lexer != SCLEX_HTML && - lexer != SCLEX_PERL) + if (doc_list[idx].file_type->id != GEANY_FILETYPES_PHP && + doc_list[idx].file_type->id != GEANY_FILETYPES_C && + doc_list[idx].file_type->id != GEANY_FILETYPES_D && + doc_list[idx].file_type->id != GEANY_FILETYPES_CPP && + doc_list[idx].file_type->id != GEANY_FILETYPES_PERL && + doc_list[idx].file_type->id != GEANY_FILETYPES_JAVA && + doc_list[idx].file_type->id != GEANY_FILETYPES_FERITE) return; // return, if we are in a comment, or when SCLEX_HTML but not in PHP @@ -713,9 +732,9 @@ void sci_cb_auto_forif(ScintillaObject *sci, gint pos, gint idx) style == SCE_C_STRING || style == SCE_C_CHARACTER || style == SCE_C_PREPROCESSOR)) return; - if (lexer == SCLEX_HTML && ! (style >= 118 && style <= 127)) return; + //if (lexer == SCLEX_HTML && ! (style >= 118 && style <= 127)) return; - if (lexer == SCLEX_HTML && ( + if (doc_list[idx].file_type->id == GEANY_FILETYPES_PHP && ( style == SCE_HPHP_SIMPLESTRING || style == SCE_HPHP_HSTRING || style == SCE_HPHP_COMMENTLINE || diff --git a/src/sci_cb.h b/src/sci_cb.h index af17292d..a6273b56 100644 --- a/src/sci_cb.h +++ b/src/sci_cb.h @@ -35,18 +35,18 @@ gchar **html_entities; -// callback func called by all editors when a signals arises +// callback func called by all editors when a signal arises void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data); gboolean sci_cb_start_auto_complete(gint idx, gint pos, gboolean force); void sci_cb_get_indent(ScintillaObject *sci, gint pos, gboolean use_this_line); -void sci_cb_close_block(ScintillaObject *sci, gint pos); +void sci_cb_close_block(gint idx, gint pos); -void sci_cb_auto_forif(ScintillaObject *sci, gint pos, gint idx); +void sci_cb_auto_forif(gint idx, gint pos); -void sci_cb_auto_latex(ScintillaObject *sci, gint pos, gint idx); +void sci_cb_auto_latex(gint idx, gint pos); void sci_cb_show_macro_list(ScintillaObject *sci); @@ -54,7 +54,7 @@ gboolean sci_cb_handle_xml(ScintillaObject *sci, gchar ch); void sci_cb_find_current_word(ScintillaObject *sci, gint pos, gchar *word, size_t wordlen); -gboolean sci_cb_show_calltip(ScintillaObject *sci, gint pos, gint idx); +gboolean sci_cb_show_calltip(gint idx, gint pos); void sci_cb_do_comment(gint idx);