fix own regression in 2.66 [#34610] Text editor: Syntax highlighting freezes
authorCampbell Barton <ideasman42@gmail.com>
Tue, 12 Mar 2013 08:46:12 +0000 (08:46 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 12 Mar 2013 08:46:12 +0000 (08:46 +0000)
source/blender/editors/space_text/text_format.c
source/blender/editors/space_text/text_format_lua.c
source/blender/editors/space_text/text_format_osl.c
source/blender/editors/space_text/text_format_py.c

index 3c78972..b29c642 100644 (file)
@@ -144,7 +144,7 @@ int text_check_format_len(TextLine *line, unsigned int len)
  * Fill the string with formatting constant,
  * advancing \a str_p and \a fmt_p
  *
- * \param len length in bytes
+ * \param len length in bytes of \a fmt_p to fill.
  */
 void text_format_fill(const char **str_p, char **fmt_p, const char type, const int len)
 {
index 6c72e04..f74d1cf 100644 (file)
@@ -237,7 +237,7 @@ static void txtfmt_lua_format_line(SpaceText *st, TextLine *line, const int do_n
                        }
                        /* Single line comment */
                        else if (*str == '-' && *(str + 1) == '-') {
-                               text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(str - fs.buf));
+                               text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(fmt - line->format));
                        }
                        else if (*str == '"' || *str == '\'') {
                                /* Strings */
index 7d493eb..59bbd82 100644 (file)
@@ -252,7 +252,7 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const int do_n
                        /* Deal with comments first */
                        if (*str == '/' && *(str + 1) == '/') {
                                /* fill the remaining line */
-                               text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(str - fs.buf));
+                               text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(fmt - line->format));
                        }
                        /* C-Style (multi-line) comments */
                        else if (*str == '/' && *(str + 1) == '*') {
index 902d60d..9562d57 100644 (file)
@@ -233,7 +233,7 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const int do_ne
                        /* Deal with comments first */
                        if (*str == '#') {
                                /* fill the remaining line */
-                               text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(str - fs.buf));
+                               text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(fmt - line->format));
                        }
                        else if (*str == '"' || *str == '\'') {
                                /* Strings */