Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-02-18 16:00:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-02-18 16:00:17 +0400
commit1c216337f08af38fbba0f60b9dc6036491a6ab2a (patch)
treefa5da590a120766d8e6389fb722f66b37684b3ab /source/blender/editors/space_text
parentde23a9bfd5f693ac2e45f015ab0c9dc28782aee3 (diff)
make autocomplete use unicode character stepping (needed for bugfix).
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/text_autocomplete.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c
index 94977fc5f0f..62e5728bd3c 100644
--- a/source/blender/editors/space_text/text_autocomplete.c
+++ b/source/blender/editors/space_text/text_autocomplete.c
@@ -162,23 +162,28 @@ static GHash *text_autocomplete_build(Text *text)
gh = BLI_ghash_str_new(__func__);
for (linep = text->lines.first; linep; linep = linep->next) {
- int i_start = 0;
- int i_end = 0;
+ size_t i_start = 0;
+ size_t i_end = 0;
+ size_t i_step = 0;
while (i_start < linep->len) {
/* seek identifier beginning */
- while (i_start < linep->len && !text_check_identifier_nodigit(linep->line[i_start])) {
- i_start++;
+ while ((i_start < linep->len) &&
+ (!text_check_identifier_nodigit(BLI_str_utf8_as_unicode_step(&linep->line[i_start], &i_step))))
+ {
+ i_start = i_step;
}
i_end = i_start;
- while (i_end < linep->len && text_check_identifier(linep->line[i_end])) {
- i_end++;
+ while ((i_end < linep->len) &&
+ (!text_check_identifier(BLI_str_utf8_as_unicode_step(&linep->line[i_end], &i_step))))
+ {
+ i_end = i_step;
}
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])))
+ * this prevents digits from being added */
+ ((i_start < 1) || !text_check_identifier(BLI_str_utf8_as_unicode(&linep->line[i_start - 1]))))
{
char *str_sub = &linep->line[i_start];
const int choice_len = i_end - i_start;