From fe83dc68828b70b0f7feeb82f341c505ac6d7c73 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Jan 2013 04:43:37 +0000 Subject: dont add identifiers starting with digits to autocomplete --- source/blender/editors/space_text/text_autocomplete.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_text') 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; -- cgit v1.2.3