mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 18:51:41 +02:00
Keyboard protocol: Fix the Enter Tab and Backspace keys generating spurious release events even when report all keys as escape codes is not set
Fixes #7136
This commit is contained in:
@@ -43,6 +43,14 @@ The :doc:`ssh kitten <kittens/ssh>` is redesigned with powerful new features:
|
|||||||
Detailed list of changes
|
Detailed list of changes
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
|
0.33.0 [future]
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
- Keyboard protocol: Fix the :kbd:`Enter`, :kbd:`Tab` and :kbd:`Backspace` keys
|
||||||
|
generating spurious release events even when report all keys as escape codes
|
||||||
|
is not set (:iss:`7136`)
|
||||||
|
|
||||||
|
|
||||||
0.32.2 [2024-02-12]
|
0.32.2 [2024-02-12]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@@ -348,6 +348,13 @@ and key release events. Normally only key press events are reported and key
|
|||||||
repeat events are treated as key press events. See :ref:`event_types` for
|
repeat events are treated as key press events. See :ref:`event_types` for
|
||||||
details on how these are reported.
|
details on how these are reported.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
The :kbd:`Enter`, :kbd:`Tab` and :kbd:`Backspace` keys will not have release
|
||||||
|
events unless :ref:`report_all_keys` is also set, so that the user can still
|
||||||
|
type reset at a shell prompt when a program that sets this mode ends without
|
||||||
|
resetting it.
|
||||||
|
|
||||||
.. _report_alternates:
|
.. _report_alternates:
|
||||||
|
|
||||||
Report alternate keys
|
Report alternate keys
|
||||||
|
|||||||
@@ -176,9 +176,9 @@ encode_function_key(const KeyEvent *ev, char *output) {
|
|||||||
}
|
}
|
||||||
if (!ev->report_text) {
|
if (!ev->report_text) {
|
||||||
switch(key_number) {
|
switch(key_number) {
|
||||||
case GLFW_FKEY_ENTER: SIMPLE("\r");
|
case GLFW_FKEY_ENTER: if (ev->action == RELEASE) return -1; SIMPLE("\r");
|
||||||
case GLFW_FKEY_BACKSPACE: SIMPLE("\x7f");
|
case GLFW_FKEY_BACKSPACE: if (ev->action == RELEASE) return -1; SIMPLE("\x7f");
|
||||||
case GLFW_FKEY_TAB: SIMPLE("\t");
|
case GLFW_FKEY_TAB: if (ev->action == RELEASE) return -1; SIMPLE("\t");
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -438,6 +438,9 @@ class TestKeys(BaseTest):
|
|||||||
ae(tq(ord('a'), action=defines.GLFW_REPEAT), csi(num='a', action=2))
|
ae(tq(ord('a'), action=defines.GLFW_REPEAT), csi(num='a', action=2))
|
||||||
ae(tq(ord('a'), action=defines.GLFW_RELEASE), csi(num='a', action=3))
|
ae(tq(ord('a'), action=defines.GLFW_RELEASE), csi(num='a', action=3))
|
||||||
ae(tq(ord('a'), action=defines.GLFW_RELEASE, mods=shift), csi(shift, num='a', action=3))
|
ae(tq(ord('a'), action=defines.GLFW_RELEASE, mods=shift), csi(shift, num='a', action=3))
|
||||||
|
tq = partial(enc, key_encoding_flags=0b11)
|
||||||
|
ae(tq(defines.GLFW_FKEY_BACKSPACE), '\x7f')
|
||||||
|
ae(tq(defines.GLFW_FKEY_BACKSPACE, action=release), '')
|
||||||
|
|
||||||
# test alternate key reporting
|
# test alternate key reporting
|
||||||
aq = partial(enc, key_encoding_flags=0b100)
|
aq = partial(enc, key_encoding_flags=0b100)
|
||||||
|
|||||||
Reference in New Issue
Block a user