[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54625] trunk/blender/source/blender/ editors/space_text/text_autocomplete.c: make autocomplete use unicode character stepping (needed for bugfix).

Campbell Barton ideasman42 at gmail.com
Mon Feb 18 13:00:18 CET 2013


Revision: 54625
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54625
Author:   campbellbarton
Date:     2013-02-18 12:00:17 +0000 (Mon, 18 Feb 2013)
Log Message:
-----------
make autocomplete use unicode character stepping (needed for bugfix).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_text/text_autocomplete.c

Modified: trunk/blender/source/blender/editors/space_text/text_autocomplete.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_autocomplete.c	2013-02-18 11:50:03 UTC (rev 54624)
+++ trunk/blender/source/blender/editors/space_text/text_autocomplete.c	2013-02-18 12:00:17 UTC (rev 54625)
@@ -162,23 +162,28 @@
 		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;




More information about the Bf-blender-cvs mailing list