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:
authorSybren A. Stüvel <sybren@blender.org>2019-08-13 16:35:48 +0300
committerSybren A. Stüvel <sybren@blender.org>2019-08-14 17:59:37 +0300
commit05417b22206c479b5ebe8ac8e7dd73ae154c8c96 (patch)
treeaa11344ee7e5fa0bf8c95ce380e347d11a3df16f /source/blender/makesrna/intern/rna_text_api.c
parent72eb70f93328e4e19a319aa199f6c46a0c8ab420 (diff)
Text editor: syntax highlighting + line numbers on by default
The most common use of the text editor seems to be for scripting. Having line numbers and syntax highlighting enabled by default seems sensible. Syntax highlighting is now enabled by default, but is automatically disabled when the datablock has a non-highlighted extension. Highlighting is enabled for filenames like: - Text - Text.001 - somefile.py and is automatically disabled when the datablock has an extension for which Blender has no syntax highlighter registered. Reviewers: billreynish, campbellbarton Subscribers: brecht, billreynish Differential Revision: https://developer.blender.org/D5472
Diffstat (limited to 'source/blender/makesrna/intern/rna_text_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_text_api.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_text_api.c b/source/blender/makesrna/intern/rna_text_api.c
index 4ca48226ee9..524dcfa9ad7 100644
--- a/source/blender/makesrna/intern/rna_text_api.c
+++ b/source/blender/makesrna/intern/rna_text_api.c
@@ -23,6 +23,8 @@
#include "BLI_utildefines.h"
+#include "ED_text.h"
+
#include "RNA_define.h"
#include "rna_internal.h" /* own include */
@@ -59,6 +61,14 @@ void RNA_api_text(StructRNA *srna)
func, "write text at the cursor location and advance to the end of the text block");
parm = RNA_def_string(func, "text", "Text", 0, "", "New text for this data-block");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(
+ srna, "is_syntax_highlight_supported", "ED_text_is_syntax_highlight_supported");
+ RNA_def_function_return(func,
+ RNA_def_boolean(func, "is_syntax_highlight_supported", false, "", ""));
+ RNA_def_function_ui_description(func,
+ "Returns True if the editor supports syntax highlighting "
+ "for the current text datablock");
}
#endif