From ac00187ad4105872b391541dca6c102bfeb0bca7 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 19 Apr 2010 14:39:42 +0200 Subject: [PATCH] Add a static global variable to monitor autocompletion mode in order to prevent cancellation of the struct/class (C/C++) auto completion list. --- src/editor.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/editor.c b/src/editor.c index eefa85d04..b374e3741 100644 --- a/src/editor.c +++ b/src/editor.c @@ -88,6 +88,13 @@ static struct ScintillaObject *sci; } calltip = {NULL, FALSE, NULL, 0, 0, NULL}; +static enum { + AUTOC_CANCELLED, + AUTOC_SCOPE, + AUTOC_TAGS, + AUTOC_DOC_WORDS, +} autocompletion_mode = AUTOC_CANCELLED; + static gchar indent[100]; @@ -597,7 +604,10 @@ static void autocomplete_scope(GeanyEditor *editor) tags = tm_workspace_find_scope_members(obj ? obj->tags_array : NULL, name, TRUE, FALSE); if (tags) + { + autocompletion_mode = AUTOC_SCOPE; show_tags_list(editor, tags, 0); + } } } @@ -932,6 +942,7 @@ static gboolean on_editor_notify(G_GNUC_UNUSED GObject *object, GeanyEditor *edi case SCN_AUTOCCANCELLED: /* now that autocomplete is finishing or was cancelled, reshow calltips * if they were showing */ + autocompletion_mode = AUTOC_CANCELLED; request_reshowing_calltip(nt); break; @@ -1775,6 +1786,7 @@ autocomplete_tags(GeanyEditor *editor, const gchar *root, gsize rootlen) tags = tm_workspace_find(root, tm_tag_max_t, attrs, TRUE, doc->file_type->lang); if (tags) { + autocompletion_mode = AUTOC_TAGS; show_tags_list(editor, tags, rootlen); return tags->len > 0; } @@ -1913,6 +1925,7 @@ static gboolean autocomplete_doc_word(GeanyEditor *editor, gchar *root, gsize ro g_slist_free(list); g_string_free(words, TRUE); + autocompletion_mode = AUTOC_DOC_WORDS; show_autocomplete(sci, rootlen, str->str); g_string_free(str, TRUE); return TRUE; @@ -1972,7 +1985,7 @@ gboolean editor_start_auto_complete(GeanyEditor *editor, gint pos, gboolean forc root = linebuf + startword; rootlen = current - startword; - if (rootlen > 0) + if (rootlen > 0 && autocompletion_mode != AUTOC_SCOPE) { if (autocomplete_check_for_html(ft->id, style)) { -- 2.11.4.GIT