[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13927] trunk/blender/source/blender/ blenkernel/intern/text.c: fix for [#8408] Indentation error in text editor when typing a colon anywhere
Campbell Barton
ideasman42 at gmail.com
Sat Mar 1 13:31:00 CET 2008
Revision: 13927
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13927
Author: campbellbarton
Date: 2008-03-01 13:31:00 +0100 (Sat, 01 Mar 2008)
Log Message:
-----------
fix for [#8408] Indentation error in text editor when typing a colon anywhere
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 2008-03-01 10:59:38 UTC (rev 13926)
+++ trunk/blender/source/blender/blenkernel/intern/text.c 2008-03-01 12:31:00 UTC (rev 13927)
@@ -2352,7 +2352,7 @@
int test = 0;
char *word = ":";
char *comm = "#";
- char back_words[3][7] = {"return", "break", "pass"};
+ char back_words[4][7] = {"return", "break", "pass", "yield"};
if (!text) return 0;
if (!text->curl) return 0;
@@ -2369,16 +2369,25 @@
if(strstr(text->curl->line, word))
{
//if we find a : then add a tab but not if it is in a comment
- if(strcspn(text->curl->line, word) < strcspn(text->curl->line, comm))
+ int a, indent = 0;
+ for(a=0; text->curl->line[a] != '\0'; a++)
{
+ if (text->curl->line[a]=='#') {
+ break;
+ } else if (text->curl->line[a]==':') {
+ indent = 1;
+ } else if (text->curl->line[a]==']') {
+ indent = 0;
+ }
+ }
+ if (indent) {
i++;
-
}
}
- while(test < 3)
+ for(test=0; test < 4; test++)
{
- //if there are these 3 key words then remove a tab because we are done with the block
+ //if there are these 4 key words then remove a tab because we are done with the block
if(strstr(text->curl->line, back_words[test]) && i > 0)
{
if(strcspn(text->curl->line, back_words[test]) < strcspn(text->curl->line, comm))
@@ -2386,7 +2395,6 @@
i--;
}
}
- test++;
}
return i;
}
More information about the Bf-blender-cvs
mailing list