[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24626] trunk/blender/source/blender/ blenkernel/intern/text.c: insert spaces instead of tabs, makes editing templates less painfull, tho we should really have a function to insert strings rather then char' s for this to work better.

Campbell Barton ideasman42 at gmail.com
Wed Nov 18 02:16:51 CET 2009


Revision: 24626
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24626
Author:   campbellbarton
Date:     2009-11-18 02:16:49 +0100 (Wed, 18 Nov 2009)

Log Message:
-----------
insert spaces instead of tabs, makes editing templates less painfull, tho we should really have a function to insert strings rather then char's for this to work better.

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	2009-11-17 22:46:42 UTC (rev 24625)
+++ trunk/blender/source/blender/blenkernel/intern/text.c	2009-11-18 01:16:49 UTC (rev 24626)
@@ -2368,6 +2368,16 @@
 		return 1;
 	}
 	
+	/* insert spaces rather then tabs
+	 * TODO, this will run an undo push each time (not nice) */
+	if (add == '\t') {
+		int totspace = 4 - (text->curl->len % 4);
+		while(totspace--) {
+			txt_add_char(text, ' ');
+		}
+		return 1;
+	}
+
 	txt_delete_sel(text);
 	
 	mrk= txt_find_marker_region(text, text->curl, text->curc-1, text->curl->len, 0, 0);





More information about the Bf-blender-cvs mailing list