Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 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 @@ -148,7 +149,12 @@ def _(event):
deleted = line.delete_before_cursor(count=-line.document.get_start_of_line_position())
line.set_clipboard(ClipboardData(deleted))

# 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.
Expand All @@ -158,6 +164,10 @@ def _(event):
deleted = line.delete_before_cursor(count=-pos)
line.set_clipboard(ClipboardData(deleted))

# Quit autocomplete mode.
if event.input_processor.input_mode == InputMode.COMPLETE:
event.input_processor.pop_input_mode()

@handle(Keys.PageUp, in_mode=InputMode.COMPLETE)
def _(event):
line.complete_previous(5)
Expand Down