[geany/geany] 3ebcfe: Merge pull request #3176 from techee/autocomplete_icon
Jiří Techet
git-noreply at geany.org
Sat Apr 30 22:44:51 UTC 2022
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: GitHub <noreply at github.com>
Date: Sat, 30 Apr 2022 22:44:51 UTC
Commit: 3ebcfee4c729e745979c6f830ed8dc2ba7c7cace
https://github.com/geany/geany/commit/3ebcfee4c729e745979c6f830ed8dc2ba7c7cace
Log Message:
-----------
Merge pull request #3176 from techee/autocomplete_icon
Show correct icons in autocompletion popups
Modified Paths:
--------------
src/editor.c
src/symbols.c
src/symbols.h
Modified: src/editor.c
22 lines changed, 15 insertions(+), 7 deletions(-)
===================================================================
@@ -619,6 +619,8 @@ static void show_tags_list(GeanyEditor *editor, const GPtrArray *tags, gsize roo
for (j = 0; j < tags->len; ++j)
{
TMTag *tag = tags->pdata[j];
+ gint group;
+ guint icon_id;
if (j > 0)
g_string_append_c(words, '\n');
@@ -630,11 +632,13 @@ static void show_tags_list(GeanyEditor *editor, const GPtrArray *tags, gsize roo
}
g_string_append(words, tag->name);
- /* for now, tag types don't all follow C, so just look at arglist */
- if (!EMPTY(tag->arglist))
- g_string_append(words, "?2");
- else
- g_string_append(words, "?1");
+ group = tm_parser_get_sidebar_group(tag->lang, tag->type);
+ if (group >= 0 && tm_parser_get_sidebar_info(tag->lang, group, &icon_id))
+ {
+ gchar buf[10];
+ sprintf(buf, "?%u", icon_id + 1);
+ g_string_append(words, buf);
+ }
}
show_autocomplete(sci, rootlen, words);
g_string_free(words, TRUE);
@@ -4850,6 +4854,7 @@ static ScintillaObject *create_new_sci(GeanyEditor *editor)
{
ScintillaObject *sci;
int rectangular_selection_modifier;
+ guint i;
sci = SCINTILLA(scintilla_new());
@@ -4874,8 +4879,11 @@ static ScintillaObject *create_new_sci(GeanyEditor *editor)
SSM(sci, SCI_SETSCROLLWIDTHTRACKING, 1, 0);
/* tag autocompletion images */
- register_named_icon(sci, 1, "classviewer-var");
- register_named_icon(sci, 2, "classviewer-method");
+ for (i = 0; i < TM_N_ICONS; i++)
+ {
+ const gchar *icon_name = symbols_get_icon_name(i);
+ register_named_icon(sci, i + 1, icon_name);
+ }
/* necessary for column mode editing, implemented in Scintilla since 2.0 */
SSM(sci, SCI_SETADDITIONALSELECTIONTYPING, 1, 0);
Modified: src/symbols.c
8 lines changed, 8 insertions(+), 0 deletions(-)
===================================================================
@@ -2023,6 +2023,14 @@ gint symbols_get_current_scope(GeanyDocument *doc, const gchar **tagname)
}
+const gchar *symbols_get_icon_name(guint icon_id)
+{
+ if (icon_id < TM_N_ICONS)
+ return symbols_icons[icon_id].icon_name;
+ return NULL;
+}
+
+
static void on_symbol_tree_sort_clicked(GtkMenuItem *menuitem, gpointer user_data)
{
gint sort_mode = GPOINTER_TO_INT(user_data);
Modified: src/symbols.h
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -63,6 +63,8 @@ gint symbols_get_current_function(GeanyDocument *doc, const gchar **tagname);
gint symbols_get_current_scope(GeanyDocument *doc, const gchar **tagname);
+const gchar *symbols_get_icon_name(guint icon_id);
+
#endif /* GEANY_PRIVATE */
G_END_DECLS
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list