Repository navigation
Description
Summary
The chord helper accepts a bare plus sign but cannot express Ctrl+plus with the same notation. The structured input API can encode the event.
Reproduction
-
From the tagged
libvtcheckout, install the locked development dependencies withuv sync --frozen --python 3.14 --all-groups --all-extras. Use the checkout root as the working directory. -
Save the following as
case.pyat the checkout root.
from libvt import Terminal
from libvt.input import KeyEvent, KeyMod
term = Terminal()
term.feed(b"\x1b[>8u")
assert term.encode(KeyEvent.parse("+")) == term.encode(KeyEvent("+"))
direct = term.encode(KeyEvent("+", KeyMod.CTRL))
print("structured Ctrl+plus", direct)
try:
parsed = KeyEvent.parse("ctrl++")
except ValueError as error:
print(str(error))
raise SystemExit(1) from None
assert term.encode(parsed) == direct- Run the case.
$ uv run --no-sync python case.pyExpected
A documented spelling should map to a plus key with the requested modifiers.
Actual
Parsing the chord raises an unknown-modifier error for an empty token.
Environment
Tested versions
CPython 3.14.6 on Linux ARM64 under WSL2. The example produced the reported result against both v0.0.1a4 and the tested trunk revision.
Evidence
Observed output
structured Ctrl+plus b'\x1b[43;5u'
unknown key modifier '' in chord 'ctrl++'
Proposal
Treat a trailing literal plus explicitly or document a named plus-key token. Cover Ctrl, Alt and a combined modifier case.
- Developer experience — Higher-level send_key calls can express a common zoom shortcut without constructing an event object.
- Immediate benefit — Users can drive zoom controls with the same syntax as other shortcuts.
- Longer-term benefit — Recorder playback and hand-written key sequences share an unambiguous chord grammar.
- End-user experience — A familiar shortcut works the first time it is written.
Activity
tony commentedon Dec 3, 2026
KeyEvent.parse('ctrl++')treats the last plus as the key. In Kitty report-all mode it emitsESC [ 43 ; 5 u, matching a directly constructed Ctrl-plus event. PR #187