Apply autosuggestion or jump to end of line.
(event: KeyPressEvent)
| 461 | |
| 462 | |
| 463 | def accept_or_jump_to_end(event: KeyPressEvent): |
| 464 | """Apply autosuggestion or jump to end of line.""" |
| 465 | buffer = event.current_buffer |
| 466 | d = buffer.document |
| 467 | after_cursor = d.text[d.cursor_position :] |
| 468 | lines = after_cursor.split("\n") |
| 469 | end_of_current_line = lines[0].strip() |
| 470 | suggestion = buffer.suggestion |
| 471 | if (suggestion is not None) and (suggestion.text) and (end_of_current_line == ""): |
| 472 | buffer.insert_text(suggestion.text) |
| 473 | else: |
| 474 | nc.end_of_line(event) |
| 475 | |
| 476 | |
| 477 | def accept(event: KeyPressEvent): |
no outgoing calls
searching dependent graphs…