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:
authorDalai Felinto <dfelinto@gmail.com>2010-01-17 06:15:27 +0300
committerDalai Felinto <dfelinto@gmail.com>2010-01-17 06:15:27 +0300
commite02ad764eeef214bd550d4266dc2d582bd7060ec (patch)
tree663c318e0091e331b6b6cb577711e3513dafcfde /source/blender/blenkernel/intern/text.c
parenta806cfb6a59971bd00a49fcab678d9fae659e851 (diff)
Text Editor: indent and unindent now supports tabs/spaces according to (text->flags & TXT_TABSTOSPACES).
Code-wise it looks now (again) that tab is the default. I hope that'ok. For bitwise operation it's cleaner IMO if the check is for positive values on them. * TXT_TABSIZE is still harcoded to 4 spaces *
Diffstat (limited to 'source/blender/blenkernel/intern/text.c')
-rw-r--r--source/blender/blenkernel/intern/text.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index f17a3a2423f..50f7f6682f1 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -2461,13 +2461,18 @@ void indent(Text *text)
{
int len, num;
char *tmp;
- /* char *addtab = "\t";
- int tablen = 1; */
+
+ char *add = "\t";
+ int indentlen = 1;
+
/* hardcoded: TXT_TABSIZE = 4 spaces: */
int spaceslen = TXT_TABSIZE;
- /* hardcoded: use spaces: */
- char *add = tab_to_spaces;
- int indentlen = spaceslen;
+
+ /* insert spaces rather then tabs */
+ if (text->flags & TXT_TABSTOSPACES){
+ add = tab_to_spaces;
+ indentlen = spaceslen;
+ }
if (!text) return;
if (!text->curl) return;
@@ -2518,11 +2523,17 @@ void indent(Text *text)
void unindent(Text *text)
{
int num = 0;
- /* char *rmtab = "\t"; */
- char *remove = tab_to_spaces;
- /* int indenttab = 1; */
- int indentspaces = TXT_TABSIZE;
- int indent = indentspaces;
+ char *remove = "\t";
+ int indent = 1;
+
+ /* hardcoded: TXT_TABSIZE = 4 spaces: */
+ int spaceslen = TXT_TABSIZE;
+
+ /* insert spaces rather then tabs */
+ if (text->flags & TXT_TABSTOSPACES){
+ remove = tab_to_spaces;
+ indent = spaceslen;
+ }
if (!text) return;
if (!text->curl) return;