diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2019-08-13 16:35:48 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2019-08-14 17:59:37 +0300 |
commit | 05417b22206c479b5ebe8ac8e7dd73ae154c8c96 (patch) | |
tree | aa11344ee7e5fa0bf8c95ce380e347d11a3df16f /release | |
parent | 72eb70f93328e4e19a319aa199f6c46a0c8ab420 (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 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/space_text.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py index 1ffb181b219..e82c6bc5dc7 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -50,7 +50,11 @@ class TEXT_HT_header(Header): row = layout.row(align=True) row.prop(st, "show_line_numbers", text="") row.prop(st, "show_word_wrap", text="") - row.prop(st, "show_syntax_highlight", text="") + + is_syntax_highlight_supported = st.is_syntax_highlight_supported() + syntax = row.row(align=True) + syntax.active = is_syntax_highlight_supported + syntax.prop(st, "show_syntax_highlight", text="") if text: is_osl = text.name.endswith((".osl", ".osl")) @@ -65,6 +69,7 @@ class TEXT_HT_header(Header): row.prop(text, "use_module") row = layout.row() + row.active = is_syntax_highlight_supported row.operator("text.run_script") @@ -226,7 +231,9 @@ class TEXT_MT_view(Menu): layout.prop(st, "show_line_numbers") layout.prop(st, "show_word_wrap") - layout.prop(st, "show_syntax_highlight") + syntax = layout.column() + syntax.active = st.is_syntax_highlight_supported() + syntax.prop(st, "show_syntax_highlight") layout.prop(st, "show_line_highlight") layout.separator() |