From a8406439938d3eb405c144a50d87100f48f77c7e Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 31 Dec 2010 04:09:15 +0000 Subject: Bugfix [#25414] Entering a newline before a : still indents it Fixed by patch attached by submitter. Cheers Jacob F (racoon)! 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. --- source/blender/blenkernel/intern/text.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/text.c') diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index bbdc188d580..bb3a31a0977 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2710,9 +2710,13 @@ int setcurr_tab_spaces (Text *text, int space) } 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; -- cgit v1.2.3