[geany/geany] 981320: Skip [] when performing scope autocompletion
Jiří Techet
git-noreply at xxxxx
Thu Feb 11 14:36:01 UTC 2016
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Mon, 18 Jan 2016 21:56:10 UTC
Commit: 981320c3b882ca4aa2e7af152e5513dbf985d079
https://github.com/geany/geany/commit/981320c3b882ca4aa2e7af152e5513dbf985d079
Log Message:
-----------
Skip [] when performing scope autocompletion
In addition to skipping function parameters, we can also skip indexes so
in something like
foo[2].
we get autocompletion for foo's type members.
Modified Paths:
--------------
src/editor.c
Modified: src/editor.c
10 lines changed, 6 insertions(+), 4 deletions(-)
===================================================================
@@ -705,6 +705,7 @@ static gboolean autocomplete_scope(GeanyEditor *editor, const gchar *root, gsize
ScintillaObject *sci = editor->sci;
gint pos = sci_get_current_position(editor->sci);
gchar typed = sci_get_char_at(sci, pos - 1);
+ gchar brace_char;
gchar *name;
GeanyFiletype *ft = editor->document->file_type;
GPtrArray *tags;
@@ -748,18 +749,19 @@ static gboolean autocomplete_scope(GeanyEditor *editor, const gchar *root, gsize
while (pos > 0 && isspace(sci_get_char_at(sci, pos - 1)))
pos--;
- /* if function, skip to matching brace */
- if (pos > 0 && sci_get_char_at(sci, pos - 1) == ')')
+ /* if function or array index, skip to matching brace */
+ brace_char = sci_get_char_at(sci, pos - 1);
+ if (pos > 0 && (brace_char == ')' || brace_char == ']'))
{
gint brace_pos = sci_find_matching_brace(sci, pos - 1);
if (brace_pos != -1)
{
pos = brace_pos;
- function = TRUE;
+ function = brace_char == ')';
}
- /* allow for a space between opening brace and function name */
+ /* allow for a space between opening brace and name */
while (pos > 0 && isspace(sci_get_char_at(sci, pos - 1)))
pos--;
}
--------------
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