we consider the cursor at the end when there is no text after the cursor, or only whitespace.
(b: Buffer)
| 167 | empty_lines_required = python_input.accept_input_on_enter or 10000 |
| 168 | |
| 169 | def at_the_end(b: Buffer) -> bool: |
| 170 | """we consider the cursor at the end when there is no text after |
| 171 | the cursor, or only whitespace.""" |
| 172 | text = b.document.text_after_cursor |
| 173 | return text == "" or (text.isspace() and "\n" not in text) |
| 174 | |
| 175 | if python_input.paste_mode: |
| 176 | # In paste mode, always insert text. |