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>2013-01-16 07:18:22 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-01-16 07:18:22 +0400
commita6d9bcd36d6e703b515e4d68dacdc9a0050b3719 (patch)
tree6b88d141fcc86f0e4d53764b10563e608d26506d /source/blender/editors/space_text/text_format_osl.c
parente6e8bd5db42c8bc58aa5f439e2dbe479cb7e9834 (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_osl.c')
-rw-r--r--source/blender/editors/space_text/text_format_osl.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/editors/space_text/text_format_osl.c b/source/blender/editors/space_text/text_format_osl.c
index 3120e88163e..26bb5f66cef 100644
--- a/source/blender/editors/space_text/text_format_osl.c
+++ b/source/blender/editors/space_text/text_format_osl.c
@@ -228,10 +228,7 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const int do_n
/* Handle continuations */
else if (cont) {
/* C-Style comments */
- if (cont & FMT_CONT_COMMENT_CXX) {
- *fmt = FMT_TYPE_COMMENT;
- }
- else if (cont & FMT_CONT_COMMENT_C) {
+ if (cont & FMT_CONT_COMMENT_C) {
if (*str == '*' && *(str + 1) == '/') {
*fmt = FMT_TYPE_COMMENT; fmt++; str++;
*fmt = FMT_TYPE_COMMENT;
@@ -254,8 +251,8 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const int do_n
else {
/* Deal with comments first */
if (*str == '/' && *(str + 1) == '/') {
- cont = FMT_CONT_COMMENT_CXX;
- *fmt = FMT_TYPE_COMMENT;
+ /* fill the remaining line */
+ text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - (int)(str - fs.buf));
}
/* C-Style (multi-line) comments */
else if (*str == '/' && *(str + 1) == '*') {
@@ -298,8 +295,7 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const int do_n
else if ((i = txtfmt_osl_find_preprocessor(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;