diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-08 16:57:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-08 16:57:00 +0400 |
commit | a6a6184b3e081cda1f685cd9d73f417d234e7d5a (patch) | |
tree | 0e8250802c79184389b8a7010e02286256e2f5ab /release | |
parent | 76b1e8bc09410398192fce47be9ac88a7368085c (diff) |
auto indent for multi-line python statements.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/console_python.py | 7 |
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, |