MCPcopy Index your code
hub / github.com/ipython/ipython / accept_and_keep_cursor

Function accept_and_keep_cursor

IPython/terminal/shortcuts/auto_suggest.py:512–519  ·  view source on GitHub ↗

Accept autosuggestion and keep cursor in place

(event: KeyPressEvent)

Source from the content-addressed store, hash-verified

510
511
512def accept_and_keep_cursor(event: KeyPressEvent):
513 """Accept autosuggestion and keep cursor in place"""
514 buffer = event.current_buffer
515 old_position = buffer.cursor_position
516 suggestion = buffer.suggestion
517 if suggestion:
518 buffer.insert_text(suggestion.text)
519 buffer.cursor_position = old_position
520
521
522def accept_and_move_cursor_left(event: KeyPressEvent):

Callers 2

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…