Skip to content

fix(keybindings): allow "." to be bound from keybindings.toml - #11

Open
nocstah wants to merge 1 commit into
Percius04:masterfrom
nocstah:fix/keybinding-period-key
Open

fix(keybindings): allow "." to be bound from keybindings.toml#11
nocstah wants to merge 1 commit into
Percius04:masterfrom
nocstah:fix/keybinding-period-key

Conversation

@nocstah

@nocstah nocstah commented Aug 18, 2026

Copy link
Copy Markdown

The period key cannot be named anywhere in the keybinding system: it is
absent from KebindingResolver._namedKeys, _canonicalKeyName() rejects it (it
only special-cases "/", ":", "?" and ""), and _eventKeyName() returns null
for Qt.Key_Period.

The result is a silent no-op rather than an error. A user writing

[keybindings]
toggle_hidden = "."

gets an entry that parses to null, is dropped as invalid, and never binds --
indistinguishable from a typo, and with nothing in the log to say why. Since
P2.5's whole premise is that alternative layouts can move any key they like,
a punctuation key that cannot be expressed at all is a real gap.

Fixes it the same way the four existing punctuation keys are handled:
_namedKeys gains "period"/"." -> Qt.Key_Period, _canonicalKeyName() accepts
".", and eventKeyName() prefers the symbol form -- that last part matters,
because both spellings map to one Qt.Key
*, and only one canonical string may
come out of _eventKeyName() or it can never compare equal to what
_canonicalKeyName() produced.

Adds a regression check ("a punctuation key (".") can be bound from config")
covering the real user path: the override is accepted, "." reaches
toggle_hidden, its previous Ctrl+H stops working per the full-replacement
policy, and "/" -- which always worked -- still searches. Verified to fail
without the fix: override accepted=false "."->toggle_hidden=false.

CheckKeybindings' own NAMED_KEYS also needed "." so the harness can express
it: it is deliberately independent of the resolver's table, and its
single-character fallback computes Qt.Key_A + (charCode - 'a'), which for "."
is Qt.Key_A - 51.

Selfcheck on this branch: 125 passed, 1 failed, 126 total. The one failure is
the pre-existing thumbnail-video.sh check, which fails the same way on an
unmodified master build here (it needs ffmpegthumbnailer, which this machine
does not have -- see the separate PR).

Same class of gap remains for other unlisted punctuation (",", ";", "-",
"="...). Happy to generalize _canonicalKeyName() to accept any single
printable ASCII character instead of an allow-list if you would prefer that
shape.

The period key cannot be named anywhere in the keybinding system: it is
absent from KebindingResolver._namedKeys, _canonicalKeyName() rejects it (it
only special-cases "/", ":", "?" and "\"), and _eventKeyName() returns null
for Qt.Key_Period.

The result is a silent no-op rather than an error. A user writing

    [keybindings]
    toggle_hidden = "."

gets an entry that parses to null, is dropped as invalid, and never binds --
indistinguishable from a typo, and with nothing in the log to say why. Since
P2.5's whole premise is that alternative layouts can move any key they like,
a punctuation key that cannot be expressed at all is a real gap.

Fixes it the same way the four existing punctuation keys are handled:
_namedKeys gains "period"/"." -> Qt.Key_Period, _canonicalKeyName() accepts
".", and _eventKeyName() prefers the symbol form -- that last part matters,
because both spellings map to one Qt.Key_*, and only one canonical string may
come out of _eventKeyName() or it can never compare equal to what
_canonicalKeyName() produced.

Adds a regression check ("a punctuation key (".") can be bound from config")
covering the real user path: the override is accepted, "." reaches
toggle_hidden, its previous Ctrl+H stops working per the full-replacement
policy, and "/" -- which always worked -- still searches. Verified to fail
without the fix: `override accepted=false "."->toggle_hidden=false`.

CheckKeybindings' own NAMED_KEYS also needed "." so the harness can express
it: it is deliberately independent of the resolver's table, and its
single-character fallback computes Qt.Key_A + (charCode - 'a'), which for "."
is Qt.Key_A - 51.

Selfcheck on this branch: 125 passed, 1 failed, 126 total. The one failure is
the pre-existing thumbnail-video.sh check, which fails the same way on an
unmodified master build here (it needs ffmpegthumbnailer, which this machine
does not have -- see the separate PR).

Same class of gap remains for other unlisted punctuation (",", ";", "-",
"="...). Happy to generalize _canonicalKeyName() to accept any single
printable ASCII character instead of an allow-list if you would prefer that
shape.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant