[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26047] trunk/blender/source/blender/ blenkernel/intern/text.c: Text Editor: indent and unindent now supports tabs/spaces according to (text-> flags & TXT_TABSTOSPACES).
Dalai Felinto
dfelinto at gmail.com
Sun Jan 17 04:15:28 CET 2010
Revision: 26047
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26047
Author: dfelinto
Date: 2010-01-17 04:15:27 +0100 (Sun, 17 Jan 2010)
Log Message:
-----------
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 *
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/text.c
Modified: trunk/blender/source/blender/blenkernel/intern/text.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/text.c 2010-01-17 02:10:54 UTC (rev 26046)
+++ trunk/blender/source/blender/blenkernel/intern/text.c 2010-01-17 03:15:27 UTC (rev 26047)
@@ -2461,13 +2461,18 @@
{
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,12 +2523,18 @@
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;
if (!text->sell) return;
More information about the Bf-blender-cvs
mailing list