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>2012-12-29 22:25:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-12-29 22:25:03 +0400
commite9c7aaaa3ccd83ee0bb6076f1f9fb2ac5653187f (patch)
tree974e3fd9e901997e46532fafaa1d255bbac6fdcf /source/blender/editors/space_text/text_format.c
parent14ea0845807dc98a9d4601fcb5d7b232262be5dd (diff)
patch [#33609] Syntax highlighting for OSL in Text Editor
from Patrick Boelens (senshi). with modifications to split it into its own function. also added C style multi-line comment support /* ... */ I've left out the part of this patch that sets the language in the space, since I think this might be better stored in the text block. For now it simply uses OSL syntax highlighting when the extension is '.osl'.
Diffstat (limited to 'source/blender/editors/space_text/text_format.c')
-rw-r--r--source/blender/editors/space_text/text_format.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/space_text/text_format.c b/source/blender/editors/space_text/text_format.c
index f7940fc7894..9a52cacb1f9 100644
--- a/source/blender/editors/space_text/text_format.c
+++ b/source/blender/editors/space_text/text_format.c
@@ -147,10 +147,16 @@ void ED_text_format_register(TextFormatType *tft)
BLI_addtail(&tft_lb, tft);
}
-TextFormatType *ED_text_format_get(Text *UNUSED(text))
+TextFormatType *ED_text_format_get(Text *text)
{
/* NOTE: once more types are added we'll need to return some type based on 'text'
* for now this function is more of a placeholder */
- return tft_lb.first;
+ /* XXX, wrong, but OK for testing */
+ if (BLI_testextensie(text->id.name + 2, ".osl")) {
+ return tft_lb.last;
+ }
+ else {
+ return tft_lb.first;
+ }
}