https://github.com/python/cpython/commit/f4e5643df64d0c2a009ed224560044b3409a47c0
commit: f4e5643df64d0c2a009ed224560044b3409a47c0
branch: main
author: Miro HronĨok <[email protected]>
committer: pablogsal <[email protected]>
date: 2024-09-13T02:07:23+01:00
summary:

gh-124027: Support Del, PgUp, and PgDn on TERM=vt100 (#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

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2024-09-13-02-25-06.gh-issue-124027.to_9DY.rst
M Lib/_pyrepl/historical_reader.py
M Lib/_pyrepl/reader.py

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"\<page down>", "history-search-forward"),
+            (r"\x1b[6~", "history-search-forward"),
             (r"\<page up>", "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 54bd1ea0222a60..4b0700d069c621 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>", "right"),
         (r"\C-\<right>", "forward-word"),
         (r"\<delete>", "delete"),
+        (r"\x1b[3~", "delete"),
         (r"\<backspace>", "backspace"),
         (r"\M-\<backspace>", "backward-kill-word"),
         (r"\<end>", "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 ``<page up>``, ``<page down>``, and ``<delete>`` keys in the Python
+REPL when ``$TERM`` is set to ``vt100``.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to