[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33960] trunk/blender/source/blender/ blenkernel/intern/text.c: Bugfix [#25414] Entering a newline before a : still indents it

Joshua Leung aligorith at gmail.com
Fri Dec 31 05:09:16 CET 2010


Revision: 33960
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33960
Author:   aligorith
Date:     2010-12-31 05:09:15 +0100 (Fri, 31 Dec 2010)

Log Message:
-----------
Bugfix [#25414] Entering a newline before a : still indents it

Fixed by patch attached by submitter. Cheers Jacob F (racoon)!
<quote>
If you write something like...

def do_something:

...and press return it makes the new line with a tab which is good,
but if you want to move the def line down to make room above it by
pressing return while your caret is at the start of the line it
indents the new line which has the def statement on it.

Attached patch just checks if it's checking for a colon after the
caret and returns if it is.
</quote>

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-12-31 03:54:28 UTC (rev 33959)
+++ trunk/blender/source/blender/blenkernel/intern/text.c	2010-12-31 04:09:15 UTC (rev 33960)
@@ -2710,9 +2710,13 @@
 	}
 	if(strstr(text->curl->line, word))
 	{
-		//if we find a : then add a tab but not if it is in a comment
+		/* if we find a ':' on this line, then add a tab but not if it is:
+		 * 	1) in a comment
+		 * 	2) within an identifier
+		 *	3) after the cursor (text->curc), i.e. when creating space before a function def [#25414] 
+		 */
 		int a, indent = 0;
-		for(a=0; text->curl->line[a] != '\0'; a++)
+		for(a=0; (a < text->curc) && (text->curl->line[a] != '\0'); a++)
 		{
 			if (text->curl->line[a]=='#') {
 				break;





More information about the Bf-blender-cvs mailing list