Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-05-08 16:57:00 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-05-08 16:57:00 +0400
commita6a6184b3e081cda1f685cd9d73f417d234e7d5a (patch)
tree0e8250802c79184389b8a7010e02286256e2f5ab /release/scripts/modules/console_python.py
parent76b1e8bc09410398192fce47be9ac88a7368085c (diff)
auto indent for multi-line python statements.
Diffstat (limited to 'release/scripts/modules/console_python.py')
-rw-r--r--release/scripts/modules/console_python.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/release/scripts/modules/console_python.py b/release/scripts/modules/console_python.py
index 55ff84fea96..54782aa9419 100644
--- a/release/scripts/modules/console_python.py
+++ b/release/scripts/modules/console_python.py
@@ -190,12 +190,17 @@ def execute(context):
if is_multiline:
sc.prompt = PROMPT_MULTI
+ indent = line[:len(line) - len(line.lstrip())]
+ if line.rstrip().endswith(":"):
+ indent += " "
else:
sc.prompt = PROMPT
+ indent = ""
# insert a new blank line
- bpy.ops.console.history_append(text="", current_character=0,
+ bpy.ops.console.history_append(text=indent, current_character=0,
remove_duplicates=True)
+ sc.history[-1].current_character = len(indent)
# Insert the output into the editor
# not quite correct because the order might have changed,