summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-09-13 01:36:34 (GMT)
committerGitHub <noreply@github.com>2024-09-13 01:36:34 (GMT)
commit112b1704fa6165ce6386ce2d9363fb73dd799de5 (patch)
treebce010423f3e2a9c86a1c5fd150b7b32186ffe8b
parent660baa14d698379b9122e62b3d8015dd66234d3e (diff)
downloadcpython-112b1704fa6165ce6386ce2d9363fb73dd799de5.zip
cpython-112b1704fa6165ce6386ce2d9363fb73dd799de5.tar.gz
cpython-112b1704fa6165ce6386ce2d9363fb73dd799de5.tar.bz2
[3.13] gh-124027: Support Del, PgUp, and PgDn on TERM=vt100 (GH-124028) (#124029)
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 <miro@hroncok.cz>
-rw-r--r--Lib/_pyrepl/historical_reader.py2
-rw-r--r--Lib/_pyrepl/reader.py1
-rw-r--r--Misc/NEWS.d/next/Core_and_Builtins/2024-09-13-02-25-06.gh-issue-124027.to_9DY.rst2
3 files changed, 5 insertions, 0 deletions
diff --git a/Lib/_pyrepl/historical_reader.py b/Lib/_pyrepl/historical_reader.py
index f6e14bd..5d416f3 100644
--- a/Lib/_pyrepl/historical_reader.py
+++ b/Lib/_pyrepl/historical_reader.py
@@ -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:
diff --git a/Lib/_pyrepl/reader.py b/Lib/_pyrepl/reader.py
index 0b73c2f..935c520 100644
--- a/Lib/_pyrepl/reader.py
+++ b/Lib/_pyrepl/reader.py
@@ -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
index 0000000..1834ba0
--- /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``.