public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Carl George <carlwgeorge@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/python-prompt-toolkit] rawhide: Allow binding control+backspace
Date: Mon, 01 Jun 2026 18:35:56 GMT [thread overview]
Message-ID: <178033895613.1.17504978497740602822.rpms-python-prompt-toolkit-f3de74d91053@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/python-prompt-toolkit
Branch : rawhide
Commit : f3de74d91053d62d4ac8642202bd9be23dadc007
Author : Carl George <carlwgeorge@fedoraproject.org>
Date : 2026-05-22T01:33:17-05:00
Stats : +118/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/python-prompt-toolkit/c/f3de74d91053d62d4ac8642202bd9be23dadc007?branch=rawhide
Log:
Allow binding control+backspace
Allow binding control+backspace separately from backspace in modern
terminal emulators such as ptyxis, konsole, and cosmic-term.
https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1380
https://github.com/prompt-toolkit/python-prompt-toolkit/pull/1384
---
diff --git a/0001-feat-separate-handling-of-Control-H-H-and-Backspace-in-non-Windows-systems.patch b/0001-feat-separate-handling-of-Control-H-H-and-Backspace-in-non-Windows-systems.patch
new file mode 100644
index 0000000..f95f029
--- /dev/null
+++ b/0001-feat-separate-handling-of-Control-H-H-and-Backspace-in-non-Windows-systems.patch
@@ -0,0 +1,112 @@
+From b516ca1e1a449eaecc9ed166df76a91f72f7ca53 Mon Sep 17 00:00:00 2001
+From: eugenesvk <eugenesvk@users.noreply.github.com>
+Date: Sat, 27 Feb 2021 21:47:56 +0300
+Subject: [PATCH] feat: separate handling of Control-H (^H) and Backspace in
+ non-Windows systems
+
+Already separated in Windows, allows e.g. binding 'backward-kill-word' to Control-Backspace (which usually emits ^H) while leaving Backspace 'backward-delete-char'
+
+Closes #1380
+---
+ src/prompt_toolkit/input/ansi_escape_sequences.py | 9 ++++-----
+ src/prompt_toolkit/key_binding/bindings/basic.py | 3 +++
+ src/prompt_toolkit/keys.py | 4 ++--
+ tests/test_cli.py | 10 +++-------
+ 4 files changed, 12 insertions(+), 14 deletions(-)
+
+diff --git a/src/prompt_toolkit/input/ansi_escape_sequences.py b/src/prompt_toolkit/input/ansi_escape_sequences.py
+index 1fba418b..afa0121f 100644
+--- a/src/prompt_toolkit/input/ansi_escape_sequences.py
++++ b/src/prompt_toolkit/input/ansi_escape_sequences.py
+@@ -58,12 +58,11 @@ ANSI_SEQUENCES: dict[str, Keys | tuple[Keys, ...]] = {
+ "\x1f": Keys.ControlUnderscore, # Control-underscore (Also for Ctrl-hyphen.)
+ # ASCII Delete (0x7f)
+ # Vt220 (and Linux terminal) send this when pressing backspace. We map this
+- # to ControlH, because that will make it easier to create key bindings that
+- # work everywhere, with the trade-off that it's no longer possible to
+- # handle backspace and control-h individually for the few terminals that
+- # support it. (Most terminals send ControlH when backspace is pressed.)
++ # to Backspace, although that will make it harder to create key bindings that
++ # work everywhere given that some terminals don't support it
++ # (they send ControlH when backspace is pressed)
+ # See: http://www.ibb.net/~anne/keyboard.html
+- "\x7f": Keys.ControlH,
++ "\x7f": Keys.Backspace,
+ # --
+ # Various
+ "\x1b[1~": Keys.Home, # tmux
+diff --git a/src/prompt_toolkit/key_binding/bindings/basic.py b/src/prompt_toolkit/key_binding/bindings/basic.py
+index ad18df98..08913852 100644
+--- a/src/prompt_toolkit/key_binding/bindings/basic.py
++++ b/src/prompt_toolkit/key_binding/bindings/basic.py
+@@ -159,6 +159,9 @@ def load_basic_bindings() -> KeyBindings:
+ handle("backspace", filter=insert_mode, save_before=if_no_repeat)(
+ get_by_name("backward-delete-char")
+ )
++ handle("c-h", filter=insert_mode, save_before=if_no_repeat)(
++ get_by_name("backward-delete-char")
++ )
+ handle("delete", filter=insert_mode, save_before=if_no_repeat)(
+ get_by_name("delete-char")
+ )
+diff --git a/src/prompt_toolkit/keys.py b/src/prompt_toolkit/keys.py
+index ee52aee8..967349b2 100644
+--- a/src/prompt_toolkit/keys.py
++++ b/src/prompt_toolkit/keys.py
+@@ -77,6 +77,8 @@ class Keys(str, Enum):
+ ControlCircumflex = "c-^"
+ ControlUnderscore = "c-_"
+
++ Backspace = "backspace"
++
+ Left = "left"
+ Right = "right"
+ Up = "up"
+@@ -195,7 +197,6 @@ class Keys(str, Enum):
+ ControlSpace = ControlAt
+ Tab = ControlI
+ Enter = ControlM
+- Backspace = ControlH
+
+ # ShiftControl was renamed to ControlShift in
+ # 888fcb6fa4efea0de8333177e1bbc792f3ff3c24 (20 Feb 2020).
+@@ -210,7 +211,6 @@ ALL_KEYS: list[str] = [k.value for k in Keys]
+
+ # Aliases.
+ KEY_ALIASES: dict[str, str] = {
+- "backspace": "c-h",
+ "c-space": "c-@",
+ "enter": "c-m",
+ "tab": "c-i",
+diff --git a/tests/test_cli.py b/tests/test_cli.py
+index a876f299..609349ad 100644
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -164,10 +164,6 @@ def test_emacs_cursor_movements():
+ assert result.text == "hello "
+ assert cli.clipboard.get_data().text == "world"
+
+- result, cli = _feed_cli_with_input("hello world\x1b\x08\r")
+- assert result.text == "hello "
+- assert cli.clipboard.get_data().text == "world"
+-
+ # Backspace (backward-delete-char)
+ result, cli = _feed_cli_with_input("hello world\x7f\r")
+ assert result.text == "hello worl"
+@@ -292,13 +288,13 @@ def test_emacs_other_bindings():
+ assert result.text == "hello X"
+
+ # backward-kill-word: delete word before the cursor.
+- # (Esc-ControlH).
+- result, cli = _feed_cli_with_input("hello world /some/very/long/path\x1b\x08X\r")
++ # (Esc-Backspace).
++ result, cli = _feed_cli_with_input("hello world /some/very/long/path\x1b\x7fX\r")
+ assert result.text == "hello world /some/very/long/X"
+
+ # (with arguments.)
+ result, cli = _feed_cli_with_input(
+- "hello world /some/very/long/path\x1b3\x1b\x08X\r"
++ "hello world /some/very/long/path\x1b3\x1b\x7fX\r"
+ )
+ assert result.text == "hello world /some/very/X"
+
diff --git a/python-prompt-toolkit.spec b/python-prompt-toolkit.spec
index 48e4e5e..1198bc6 100644
--- a/python-prompt-toolkit.spec
+++ b/python-prompt-toolkit.spec
@@ -9,6 +9,11 @@ Summary: Library for building powerful interactive command line applicati
License: BSD-3-Clause
URL: https://github.com/prompt-toolkit/python-prompt-toolkit
Source: %{pypi_source prompt_toolkit}
+# Allow binding control+backspace separately from backspace in modern terminal
+# emulators such as ptyxis, konsole, and cosmic-term.
+# https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1380
+# https://github.com/prompt-toolkit/python-prompt-toolkit/pull/1384
+Patch: 0001-feat-separate-handling-of-Control-H-H-and-Backspace-in-non-Windows-systems.patch
BuildArch: noarch
@@ -27,7 +32,7 @@ Recommends: python3-pygments
%prep
-%autosetup -n prompt_toolkit-%{version}
+%autosetup -p 1 -n prompt_toolkit-%{version}
# Workaround for https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1988
sed -i 's/^__version__ = .*/__version__ = "%{version}"/' src/prompt_toolkit/__init__.py
reply other threads:[~2026-06-01 18:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178033895613.1.17504978497740602822.rpms-python-prompt-toolkit-f3de74d91053@fedoraproject.org \
--to=carlwgeorge@fedoraproject.org \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox