[Bf-blender-cvs] [55a44e4] master: Fix crash in text editor (wrap + syntax-highlight)

Campbell Barton noreply at git.blender.org
Tue Sep 23 17:13:15 CEST 2014


Commit: 55a44e4f302a7bf8508922dec87eb1e83ded2fef
Author: Campbell Barton
Date:   Wed Sep 24 01:10:59 2014 +1000
Branches: master
https://developer.blender.org/rB55a44e4f302a7bf8508922dec87eb1e83ded2fef

Fix crash in text editor (wrap + syntax-highlight)

===================================================================

M	source/blender/editors/space_text/text_draw.c

===================================================================

diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index e2351c8..af827d6 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -377,6 +377,7 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w
 	FlattenString fs;
 	int basex, lines;
 	int i, wrap, end, max, columns, padding; /* column */
+	/* warning, only valid when 'use_syntax' is set */
 	int a, fstart, fpos;                     /* utf8 chars */
 	int mi, ma, mstart, mend;                /* mem */
 	char fmt_prev = 0xff;
@@ -398,8 +399,11 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w
 			/* skip hidden part of line */
 			if (skip) {
 				skip--;
-				fstart = fpos = end;
-				mstart = mend;
+				if (use_syntax) {
+					/* currently fpos only used when formatting */
+					fpos += BLI_strnlen_utf8(str + mstart, mend - mstart);
+				}
+				fstart = fpos; mstart = mend;
 				mend = txt_utf8_forward_columns(str + mend, max, &padding) - str;
 				end = (wrap += max - padding);
 				continue;




More information about the Bf-blender-cvs mailing list