##// END OF EJS Templates
Backport PR #10264: Indent on new line by looking at the text before the cursor....
Thomas Kluyver -
Show More
@@ -96,12 +96,14 def newline_or_execute_outer(shell):
96 96 b.cancel_completion()
97 97 return
98 98
99 if not (d.on_last_line or d.cursor_position_row >= d.line_count
100 - d.empty_line_count_at_the_end()):
101 b.newline()
102 return
99 before_text = d.text[:d.cursor_position]
100 status, indent = shell.input_splitter.check_complete(before_text + '\n')
103 101
104 status, indent = shell.input_splitter.check_complete(d.text + '\n')
102 if not (d.on_last_line or
103 d.cursor_position_row >= d.line_count - d.empty_line_count_at_the_end()
104 ):
105 b.insert_text('\n' + (' ' * (indent or 0)))
106 return
105 107
106 108 if (status != 'incomplete') and b.accept_action.is_returnable:
107 109 b.accept_action.validate_and_handle(event.cli, b)
General Comments 0
You need to be logged in to leave comments. Login now