diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-12-31 20:40:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-12-31 20:40:14 +0400 |
commit | d191dec1d5a938c0d7d2950f5140a4811627602e (patch) | |
tree | 98ff9533c6f67255592a280dcd85b491172cf28b /source/blender/editors/space_text/text_format_py.c | |
parent | dd62a2c3756d4335479a561a52468a548f2f1d65 (diff) |
syntax highlight autocomplete listing.
Diffstat (limited to 'source/blender/editors/space_text/text_format_py.c')
-rw-r--r-- | source/blender/editors/space_text/text_format_py.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c index d68d6ae0e78..cbccc6a770f 100644 --- a/source/blender/editors/space_text/text_format_py.c +++ b/source/blender/editors/space_text/text_format_py.c @@ -154,6 +154,16 @@ static int txtfmt_py_find_bool(const char *string) return i; } +static char txtfmt_py_format_identifier(const char *str) +{ + char fmt; + if ((txtfmt_py_find_specialvar(str)) != -1) fmt = FMT_TYPE_SPECIAL; + else if ((txtfmt_py_find_builtinfunc(str)) != -1) fmt = FMT_TYPE_KEYWORD; + else if ((txtfmt_py_find_decorator(str)) != -1) fmt = FMT_TYPE_RESERVED; + else fmt = FMT_TYPE_DEFAULT; + return fmt; +} + static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const int do_next) { FlattenString fs; @@ -269,6 +279,7 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const int do_ne /* Not ws, a digit, punct, or continuing text. Must be new, check for special words */ else { /* Special vars(v) or built-in keywords(b) */ + /* keep in sync with 'txtfmt_py_format_identifier()' */ if ((i = txtfmt_py_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL; else if ((i = txtfmt_py_find_builtinfunc(str)) != -1) prev = FMT_TYPE_KEYWORD; else if ((i = txtfmt_py_find_decorator(str)) != -1) prev = FMT_TYPE_DIRECTIVE; @@ -303,7 +314,8 @@ void ED_text_format_register_py(void) static TextFormatType tft = {0}; static const char *ext[] = {"py", NULL}; - tft.format_line = txtfmt_py_format_line; + tft.format_identifier = txtfmt_py_format_identifier; + tft.format_line = txtfmt_py_format_line; tft.ext = ext; ED_text_format_register(&tft); |