Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Fri, 26 Feb 2016 00:09:59 UTC Commit: cb307e5b92479ce984aff01b106b1bdad346c0e8 https://github.com/geany/geany/commit/cb307e5b92479ce984aff01b106b1bdad346c0...
Log Message: ----------- Use the langs_compatible() function when passing typenames to scintilla
This requires making the function public and tm_tag.c seems to be a better place for the function than tm_workspace so move there and add the prefix.
Modified Paths: -------------- src/symbols.c tagmanager/src/tm_tag.c tagmanager/src/tm_tag.h tagmanager/src/tm_workspace.c
Modified: src/symbols.c 6 lines changed, 1 insertions(+), 5 deletions(-) =================================================================== @@ -293,11 +293,7 @@ GString *symbols_find_typenames_as_string(gint lang, gboolean global) tag = TM_TAG(typedefs->pdata[j]); tag_lang = tag->lang;
- /* the check for tag_lang == lang is necessary to avoid wrong type colouring of - * e.g. PHP classes in C++ files - * lang = TM_PARSER_NONE disables the check */ - if (tag->name && (tag_lang == lang || lang == TM_PARSER_NONE || - (lang == TM_PARSER_CPP && tag_lang == TM_PARSER_C))) + if (tag->name && tm_tag_langs_compatible(lang, tag_lang)) { if (j != 0) g_string_append_c(s, ' ');
Modified: tagmanager/src/tm_tag.c 16 lines changed, 16 insertions(+), 0 deletions(-) =================================================================== @@ -1226,6 +1226,22 @@ gboolean tm_tag_is_anon(const TMTag *tag) }
+gboolean tm_tag_langs_compatible(langType lang, langType other) +{ + if (lang == TM_PARSER_NONE || other == TM_PARSER_NONE) + return FALSE; + if (lang == other) + return TRUE; + /* Accept CPP tags for C lang and vice versa */ + else if (lang == TM_PARSER_C && other == TM_PARSER_CPP) + return TRUE; + else if (lang == TM_PARSER_CPP && other == TM_PARSER_C) + return TRUE; + + return FALSE; +} + + #ifdef TM_DEBUG /* various debugging functions */
/*
Modified: tagmanager/src/tm_tag.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -195,6 +195,8 @@ const gchar *tm_tag_context_separator(langType lang);
gboolean tm_tag_is_anon(const TMTag *tag);
+gboolean tm_tag_langs_compatible(langType lang, langType other); + #ifdef TM_DEBUG /* various debugging functions */
const char *tm_tag_type_name(const TMTag *tag);
Modified: tagmanager/src/tm_workspace.c 22 lines changed, 3 insertions(+), 19 deletions(-) =================================================================== @@ -685,22 +685,6 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i }
-static gboolean langs_compatible(langType lang, langType other) -{ - if (lang == TM_PARSER_NONE || other == TM_PARSER_NONE) - return FALSE; - if (lang == other) - return TRUE; - /* Accept CPP tags for C lang and vice versa */ - else if (lang == TM_PARSER_C && other == TM_PARSER_CPP) - return TRUE; - else if (lang == TM_PARSER_CPP && other == TM_PARSER_C) - return TRUE; - - return FALSE; -} - - static void fill_find_tags_array(GPtrArray *dst, const GPtrArray *src, const char *name, const char *scope, TMTagType type, langType lang) { @@ -714,7 +698,7 @@ static void fill_find_tags_array(GPtrArray *dst, const GPtrArray *src, for (i = 0; i < num; ++i) { if ((type & (*tag)->type) && - langs_compatible(lang, (*tag)->lang) && + tm_tag_langs_compatible(lang, (*tag)->lang) && (!scope || g_strcmp0((*tag)->scope, scope) == 0)) { g_ptr_array_add(dst, *tag); @@ -761,7 +745,7 @@ static void fill_find_tags_array_prefix(GPtrArray *dst, const GPtrArray *src, tag = tm_tags_find(src, name, TRUE, &count); for (i = 0; i < count && num < max_num; ++i) { - if (langs_compatible(lang, (*tag)->lang) && + if (tm_tag_langs_compatible(lang, (*tag)->lang) && !tm_tag_is_anon(*tag) && (!last || g_strcmp0(last->name, (*tag)->name) != 0)) { @@ -827,7 +811,7 @@ find_scope_members_tags (const GPtrArray *all, TMTag *type_tag, gboolean namespa
if (tag && (tag->type & member_types) && tag->scope && tag->scope[0] != '\0' && - langs_compatible(tag->lang, type_tag->lang) && + tm_tag_langs_compatible(tag->lang, type_tag->lang) && strcmp(scope, tag->scope) == 0 && (!namespace || !tm_tag_is_anon(tag))) {
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).