diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-16 08:43:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-16 08:43:37 +0400 |
commit | fe83dc68828b70b0f7feeb82f341c505ac6d7c73 (patch) | |
tree | 1c84334085985912f07e318fade6a701a05d2fe5 /source/blender/editors/space_text | |
parent | 665ea6b1161921333dddc5cc6d821fa2cac1253c (diff) |
dont add identifiers starting with digits to autocomplete
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r-- | source/blender/editors/space_text/text_autocomplete.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c index e406a1b7166..94977fc5f0f 100644 --- a/source/blender/editors/space_text/text_autocomplete.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -167,7 +167,7 @@ static GHash *text_autocomplete_build(Text *text) while (i_start < linep->len) { /* seek identifier beginning */ - while (i_start < linep->len && !text_check_identifier(linep->line[i_start])) { + while (i_start < linep->len && !text_check_identifier_nodigit(linep->line[i_start])) { i_start++; } i_end = i_start; @@ -175,7 +175,11 @@ static GHash *text_autocomplete_build(Text *text) i_end++; } - if (i_start != i_end) { + if ((i_start != i_end) && + /* check we're at the beginning of a line or that the previous char is not an identifier + * this prevents digits from being added */ + ((i_start < 1) || !text_check_identifier(linep->line[i_start - 1]))) + { char *str_sub = &linep->line[i_start]; const int choice_len = i_end - i_start; |