Add a static global variable to monitor autocompletion mode in order to prevent cancellation of the struct/class (C/C++) auto completion list (patch by Thomas Martitz, thanks).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4840 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2010-04-19 20:42:44 +00:00
parent fd6bf166af
commit c499da1b4d
2 changed files with 20 additions and 1 deletions

View File

@ -6,6 +6,10 @@
* src/sidebar.c:
Automatically show and hide the sidebar notebook tabs according
to the amount of visible pages (patch by Adrian Dimitrov, thanks).
* src/editor.c:
Add a static global variable to monitor autocompletion mode in order
to prevent cancellation of the struct/class (C/C++) auto completion
list (patch by Thomas Martitz, thanks).
2010-04-19 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -88,6 +88,14 @@ 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 +605,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 +943,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 +1787,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;
}
@ -1884,6 +1897,7 @@ static gboolean autocomplete_doc_word(GeanyEditor *editor, gchar *root, gsize ro
if (!words)
{
scintilla_send_message(sci, SCI_AUTOCCANCEL, 0, 0);
autocompletion_mode = AUTOC_CANCELLED;
return FALSE;
}
@ -1913,6 +1927,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 +1987,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))
{