insert a newline after the cursor indented appropriately.
(event)
| 239 | """ |
| 240 | |
| 241 | def newline_autoindent(event): |
| 242 | """insert a newline after the cursor indented appropriately.""" |
| 243 | b = event.current_buffer |
| 244 | d = b.document |
| 245 | |
| 246 | if b.complete_state: |
| 247 | b.cancel_completion() |
| 248 | text = d.text[:d.cursor_position] + '\n' |
| 249 | _, indent = inputsplitter.check_complete(text) |
| 250 | b.insert_text('\n' + (' ' * (indent or 0)), move_cursor=False) |
| 251 | |
| 252 | return newline_autoindent |
| 253 |
nothing calls this directly
no test coverage detected