##// END OF EJS Templates
Backport PR #12336: Fix auto formatting to be called only once.
Matthias Bussonnier -
Show More
@@ -130,8 +130,10 b' def newline_or_execute_outer(shell):'
130 # if all we have after the cursor is whitespace: reformat current text
130 # if all we have after the cursor is whitespace: reformat current text
131 # before cursor
131 # before cursor
132 after_cursor = d.text[d.cursor_position:]
132 after_cursor = d.text[d.cursor_position:]
133 reformatted = False
133 if not after_cursor.strip():
134 if not after_cursor.strip():
134 reformat_text_before_cursor(b, d, shell)
135 reformat_text_before_cursor(b, d, shell)
136 reformatted = True
135 if not (d.on_last_line or
137 if not (d.on_last_line or
136 d.cursor_position_row >= d.line_count - d.empty_line_count_at_the_end()
138 d.cursor_position_row >= d.line_count - d.empty_line_count_at_the_end()
137 ):
139 ):
@@ -142,7 +144,8 b' def newline_or_execute_outer(shell):'
142 return
144 return
143
145
144 if (status != 'incomplete') and b.accept_handler:
146 if (status != 'incomplete') and b.accept_handler:
145 reformat_text_before_cursor(b, d, shell)
147 if not reformatted:
148 reformat_text_before_cursor(b, d, shell)
146 b.validate_and_handle()
149 b.validate_and_handle()
147 else:
150 else:
148 if shell.autoindent:
151 if shell.autoindent:
General Comments 0
You need to be logged in to leave comments. Login now