Skip to content
2 changes: 2 additions & 0 deletions prompt_toolkit/key_bindings/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def _(event):
line.swap_characters_before_cursor()

@handle(Keys.ControlU, in_mode=InputMode.INSERT)
@handle(Keys.ControlU, in_mode=InputMode.COMPLETE)
def _(event):
"""
Clears the line before the cursor position. If you are at the end of
Expand All @@ -149,6 +150,7 @@ def _(event):
line.set_clipboard(ClipboardData(deleted))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure that you exit COMPLETE mode here:

 # Quit autocomplete mode. if event.input_processor.input_mode == InputMode.COMPLETE: event.input_processor.pop_input_mode()
@handle(Keys.ControlW, in_mode=InputMode.INSERT)
@handle(Keys.ControlW, in_mode=InputMode.COMPLETE)
def _(event):
"""
Delete the word before the cursor.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, at the end of the function, exit COMPLETE mode.

Expand Down