Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Sun, 23 Jan 2022 16:44:14 UTC Commit: bd93be412a5eb286cad978928d01f7e9c26da59e https://github.com/geany/geany/commit/bd93be412a5eb286cad978928d01f7e9c26da5...
Log Message: ----------- Add tm_parser_scope_separator_printable()
The added tm_parser_scope_separator_printable() function is a human readable representation of scope separator. For most languages, this is equal to the scope separator but for some (mostly markup languages), some "strange" scope separators are used like \0x3 or "" and we need something more readable when displayed to users. " > " seems to look good.
This new function can be used to: 1. Format calltips (though real languages use human-readable scope sep) 2. Symbol tree filter and display.
Modified Paths: -------------- src/symbols.c src/tagmanager/tm_parser.c src/tagmanager/tm_parser.h
Modified: src/symbols.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -338,7 +338,7 @@ static GList *get_tag_list(GeanyDocument *doc, TMTagType tag_types) gboolean filtered = FALSE; gchar **val; gchar *full_tagname = g_strconcat(tag->scope ? tag->scope : "", - tag->scope ? tm_parser_scope_separator(tag->lang) : "", + tag->scope ? tm_parser_scope_separator_printable(tag->lang) : "", tag->name, NULL); gchar *normalized_tagname = g_utf8_normalize(full_tagname, -1, G_NORMALIZE_ALL);
@@ -960,7 +960,7 @@ static const gchar *get_symbol_name(GeanyDocument *doc, const TMTag *tag, gboole if (!found_parent && scope && strpbrk(scope, GEANY_WORDCHARS) == scope) { - const gchar *sep = tm_parser_scope_separator(tag->lang); + const gchar *sep = tm_parser_scope_separator_printable(tag->lang);
g_string_append(buffer, scope); g_string_append(buffer, sep);
Modified: src/tagmanager/tm_parser.c 18 lines changed, 17 insertions(+), 1 deletions(-) =================================================================== @@ -957,7 +957,7 @@ gchar *tm_parser_format_function(TMParserType lang, const gchar *fname, const gc if (scope) { g_string_append(str, scope); - g_string_append(str, tm_parser_scope_separator(lang)); + g_string_append(str, tm_parser_scope_separator_printable(lang)); } g_string_append(str, fname); g_string_append_c(str, ' '); @@ -1030,6 +1030,22 @@ const gchar *tm_parser_scope_separator(TMParserType lang) }
+const gchar *tm_parser_scope_separator_printable(TMParserType lang) +{ + switch (lang) + { + case TM_PARSER_TXT2TAGS: + case TM_PARSER_ASCIIDOC: + case TM_PARSER_CONF: + case TM_PARSER_REST: + return " > "; + + default: + return tm_parser_scope_separator(lang); + } +} + + gboolean tm_parser_has_full_scope(TMParserType lang) { switch (lang)
Modified: src/tagmanager/tm_parser.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -141,6 +141,8 @@ gchar *tm_parser_format_function(TMParserType lang, const gchar *fname, const gc
const gchar *tm_parser_scope_separator(TMParserType lang);
+const gchar *tm_parser_scope_separator_printable(TMParserType lang); + gboolean tm_parser_has_full_scope(TMParserType lang);
gboolean tm_parser_langs_compatible(TMParserType lang, TMParserType other);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).