From 112b1704fa6165ce6386ce2d9363fb73dd799de5 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Fri, 13 Sep 2024 03:36:34 +0200 Subject: [PATCH] [3.13] gh-124027: Support Del, PgUp, and PgDn on TERM=vt100 (GH-124028) (#124029) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gh-124027: Support Del, PgUp, and PgDn on TERM=vt100 (GH-124028) pyrepl: Support Del, PgUp, and PgDn on TERM=vt100 From Fedora's /etc/inputrc: "\e[5~": history-search-backward "\e[6~": history-search-forward "\e[3~": delete-char Fixes https://github.com/python/cpython/issues/124027 (cherry picked from commit f4e5643df64d0c2a009ed224560044b3409a47c0) Co-authored-by: Miro HronĨok --- Lib/_pyrepl/historical_reader.py | 2 ++ Lib/_pyrepl/reader.py | 1 + .../2024-09-13-02-25-06.gh-issue-124027.to_9DY.rst | 2 ++ 3 files changed, 5 insertions(+) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2024-09-13-02-25-06.gh-issue-124027.to_9DY.rst diff --git a/Lib/_pyrepl/historical_reader.py b/Lib/_pyrepl/historical_reader.py index f6e14bdffc3352..5d416f336ad5d2 100644 --- a/Lib/_pyrepl/historical_reader.py +++ b/Lib/_pyrepl/historical_reader.py @@ -266,7 +266,9 @@ def collect_keymap(self) -> tuple[tuple[KeySpec, CommandName], ...]: (r"\M-r", "restore-history"), (r"\M-.", "yank-arg"), (r"\", "history-search-forward"), + (r"\x1b[6~", "history-search-forward"), (r"\", "history-search-backward"), + (r"\x1b[5~", "history-search-backward"), ) def select_item(self, i: int) -> None: diff --git a/Lib/_pyrepl/reader.py b/Lib/_pyrepl/reader.py index 0b73c2f997022a..935c520c5ad553 100644 --- a/Lib/_pyrepl/reader.py +++ b/Lib/_pyrepl/reader.py @@ -150,6 +150,7 @@ def make_default_commands() -> dict[CommandName, type[Command]]: (r"\", "right"), (r"\C-\", "forward-word"), (r"\", "delete"), + (r"\x1b[3~", "delete"), (r"\", "backspace"), (r"\M-\", "backward-kill-word"), (r"\", "end-of-line"), # was 'end' diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2024-09-13-02-25-06.gh-issue-124027.to_9DY.rst b/Misc/NEWS.d/next/Core_and_Builtins/2024-09-13-02-25-06.gh-issue-124027.to_9DY.rst new file mode 100644 index 00000000000000..1834ba0ba08bfb --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2024-09-13-02-25-06.gh-issue-124027.to_9DY.rst @@ -0,0 +1,2 @@ +Support ````, ````, and ```` keys in the Python +REPL when ``$TERM`` is set to ``vt100``.