def newline(event, chars=["{", "[", "("]): should_indent = event.current_buffer.document.char_before_cursor in chars copy_margin = not in_paste_mode() and settings.auto_indentation event.current_buffer.newline(copy_margin=copy_margin) if should_indent and settings.auto_indentation: tab_size = settings.tab_size event.current_buffer.insert_text(" " * tab_size)
def _(event): should_indent = event.current_buffer.document.char_before_cursor in ["{", "[", "("] copy_margin = not in_paste_mode() and event.app.session.auto_indentation event.current_buffer.newline(copy_margin=copy_margin) if should_indent and event.app.session.auto_indentation: tab_size = event.app.session.tab_size event.current_buffer.insert_text(" " * tab_size)
def _(event): copy_margin = not in_paste_mode() and settings.auto_indentation event.current_buffer.newline(copy_margin=copy_margin) if settings.auto_indentation: tab_size = settings.tab_size event.current_buffer.insert_text(" " * tab_size) event.current_buffer.insert_text("\n") event.current_buffer.cursor_position -= 1
def _newline(event: E) -> None: """ Newline (in case of multiline input. """ event.current_buffer.newline(copy_margin=not in_paste_mode())
def _(event: E) -> None: """ A newline replaces the selection """ event.current_buffer.cut_selection() event.current_buffer.newline(copy_margin=not in_paste_mode())
def _(event): " Newline (in case of multiline input. " event.current_buffer.newline(copy_margin=not in_paste_mode())
def _(event): if event.current_buffer.text: copy_margin = not in_paste_mode() and settings.auto_indentation event.current_buffer.newline(copy_margin=copy_margin)