Skip to content

feat: add correct handling of Control-Delete and Shift-Delete #1381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2021
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
4 changes: 3 additions & 1 deletion prompt_toolkit/input/win32.py
Original file line number Diff line number Diff line change
@@ -369,7 +369,7 @@ def _event_to_key_presses(self, ev: KEY_EVENT_RECORD) -> List[KeyPress]:
}
result.key = mapping.get(result.key, result.key)

# Correctly handle Control-Arrow/Home/End and Control-Insert keys.
# Correctly handle Control-Arrow/Home/End and Control-Insert/Delete keys.
if (
ev.ControlKeyState & self.LEFT_CTRL_PRESSED
or ev.ControlKeyState & self.RIGHT_CTRL_PRESSED
@@ -382,6 +382,7 @@ def _event_to_key_presses(self, ev: KEY_EVENT_RECORD) -> List[KeyPress]:
Keys.Home: Keys.ControlHome,
Keys.End: Keys.ControlEnd,
Keys.Insert: Keys.ControlInsert,
Keys.Delete: Keys.ControlDelete,
Keys.PageUp: Keys.ControlPageUp,
Keys.PageDown: Keys.ControlPageDown,
}
@@ -399,6 +400,7 @@ def _event_to_key_presses(self, ev: KEY_EVENT_RECORD) -> List[KeyPress]:
Keys.Home: Keys.ShiftHome,
Keys.End: Keys.ShiftEnd,
Keys.Insert: Keys.ShiftInsert,
Keys.Delete: Keys.ShiftDelete,
Keys.PageUp: Keys.ShiftPageUp,
Keys.PageDown: Keys.ShiftPageDown,
}