diff options
-rw-r--r-- | release/scripts/ui/space_text.py | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_text_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_text.c | 4 |
5 files changed, 9 insertions, 2 deletions
diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py index 5df937aacde..9ec723b51f1 100644 --- a/release/scripts/ui/space_text.py +++ b/release/scripts/ui/space_text.py @@ -78,6 +78,7 @@ class TEXT_PT_properties(bpy.types.Panel): layout = self.layout st = context.space_data + text = st.text flow = layout.column_flow() flow.prop(st, "line_numbers") @@ -88,6 +89,7 @@ class TEXT_PT_properties(bpy.types.Panel): flow = layout.column_flow() flow.prop(st, "font_size") flow.prop(st, "tab_width") + flow.prop(text, "tabs_as_spaces") class TEXT_PT_find(bpy.types.Panel): diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index c5c23c8b6c7..9af0d11c162 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2380,7 +2380,7 @@ int txt_add_char (Text *text, char add) } /* insert spaces rather then tabs */ - if (add == '\t') { + if (add == '\t' && text->flags & TXT_TABSTOSPACES) { txt_convert_tab_to_spaces(text); return 1; } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index b5d656bc2b6..fee0ee04f2e 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1800,7 +1800,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect) static void ui_draw_separator(uiBut *but, rcti *rect, uiWidgetColors *wcol) { int y = rect->ymin + (rect->ymax - rect->ymin)/2 - 1; - unsigned char col[3]; + unsigned char col[4]; col[0] = wcol->text[0]; col[1] = wcol->text[1]; diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h index 5793f061f06..9a9daf56e8a 100644 --- a/source/blender/makesdna/DNA_text_types.h +++ b/source/blender/makesdna/DNA_text_types.h @@ -84,6 +84,7 @@ typedef struct Text { #define TXT_ISSCRIPT 0x0010 /* used by space handler scriptlinks */ #define TXT_READONLY 0x0100 #define TXT_FOLLOW 0x0200 /* always follow cursor (console) */ +#define TXT_TABSTOSPACES 0x0400 /* use space instead of tabs */ /* format continuation flags */ #define TXT_NOCONT 0x00 /* no continuation */ diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index bed686ed360..3445933a3dc 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -198,6 +198,10 @@ static void rna_def_text(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISSCRIPT); RNA_def_property_ui_text(prop, "Register", "Register this text as a module on loading."); + prop= RNA_def_property(srna, "tabs_as_spaces", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_TABSTOSPACES); + RNA_def_property_ui_text(prop, "Tabs as Spaces", "Automatically converts all new tabs into spaces."); + prop= RNA_def_property(srna, "lines", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "TextLine"); RNA_def_property_ui_text(prop, "Lines", "Lines of text."); |