diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-12-31 07:09:15 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-12-31 07:09:15 +0300 |
commit | a8406439938d3eb405c144a50d87100f48f77c7e (patch) | |
tree | 91a6136d5308f39bbc826593599634463671f977 /source | |
parent | dfffad69a9dc851f35dc32e604f2e97f4f1c8fd1 (diff) |
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>
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 8 |
1 files changed, 6 insertions, 2 deletions
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; |