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>2014-09-23 19:10:59 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-09-23 19:12:55 +0400
commit55a44e4f302a7bf8508922dec87eb1e83ded2fef (patch)
tree45a0441d70af09694f49fcb815f7822d0d706dc5 /source/blender/editors/space_text
parent8ddc3d148e9d8e55a5d64774e0a2a430f92bba59 (diff)
Fix crash in text editor (wrap + syntax-highlight)
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/text_draw.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index e2351c8360f..af827d6dc5a 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;