def _(event: E) -> None:
        """
        Accept input (for single line input).
        """
        b = event.current_buffer

        if b.validate():
            # When the cursor is at the end, and we have an empty line:
            # drop the empty lines, but return the value.
            b.document = Document(
                text=b.text.rstrip(), cursor_position=len(b.text.rstrip())
            )

            b.validate_and_handle()

        Accept input (for single line input).
        
src/ptpython/key_bindings.py