diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-16 07:18:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-16 07:18:22 +0400 |
commit | a6d9bcd36d6e703b515e4d68dacdc9a0050b3719 (patch) | |
tree | 6b88d141fcc86f0e4d53764b10563e608d26506d /source/blender/editors/space_text/text_format_py.c | |
parent | e6e8bd5db42c8bc58aa5f439e2dbe479cb7e9834 (diff) |
text syntax highlighting, add utility function 'text_format_fill()' which fills in the line with a formatting value.
this fixes a mistake in OSL lexer which would comment all lines after '//'
Diffstat (limited to 'source/blender/editors/space_text/text_format_py.c')
-rw-r--r-- | source/blender/editors/space_text/text_format_py.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c index cbccc6a770f..cd9d45c5b0e 100644 --- a/source/blender/editors/space_text/text_format_py.c +++ b/source/blender/editors/space_text/text_format_py.c @@ -231,9 +231,9 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const int do_ne /* Not in a string... */ else { /* Deal with comments first */ - if (prev == FMT_TYPE_COMMENT || *str == '#') { - *fmt = FMT_TYPE_COMMENT; - str += BLI_str_utf8_size_safe(str) - 1; + if (*str == '#') { + /* fill the remaining line */ + text_format_fill(&str, &fmt, prev, len - (int)(str - fs.buf)); } else if (*str == '"' || *str == '\'') { /* Strings */ @@ -285,8 +285,7 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const int do_ne else if ((i = txtfmt_py_find_decorator(str)) != -1) prev = FMT_TYPE_DIRECTIVE; if (i > 0) { - memset(fmt, prev, i); - i--; fmt += i; str += i; + text_format_fill(&str, &fmt, prev, i); } else { str += BLI_str_utf8_size_safe(str) - 1; |