]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-124027: Support Del, PgUp, and PgDn on TERM=vt100 (#124028)
authorMiro Hrončok <miro@hroncok.cz>
Fri, 13 Sep 2024 01:07:23 +0000 (03:07 +0200)
committerGitHub <noreply@github.com>
Fri, 13 Sep 2024 01:07:23 +0000 (02:07 +0100)
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

Lib/_pyrepl/historical_reader.py
Lib/_pyrepl/reader.py
Misc/NEWS.d/next/Core_and_Builtins/2024-09-13-02-25-06.gh-issue-124027.to_9DY.rst [new file with mode: 0644]

index f6e14bdffc335217d80930cc713a95e098aa16b2..5d416f336ad5d2b26fe0969c06699dc97e5136e5 100644 (file)
@@ -266,7 +266,9 @@ class HistoricalReader(Reader):
             (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:
index 54bd1ea0222a60f81bf2fd561e9ef777325a6b5a..4b0700d069c62129672aa90266bf58c794c7e5c5 100644 (file)
@@ -150,6 +150,7 @@ default_keymap: tuple[tuple[KeySpec, CommandName], ...] = tuple(
         (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 (file)
index 0000000..1834ba0
--- /dev/null
@@ -0,0 +1,2 @@
+Support ``<page up>``, ``<page down>``, and ``<delete>`` keys in the Python
+REPL when ``$TERM`` is set to ``vt100``.