Fix enter/tab/backspace not being reported in all keys mode
This commit is contained in:
parent
af0a24c702
commit
0163bf3edb
@ -326,6 +326,8 @@ only key events are sent. If the text is needed as well, combine with the
|
|||||||
Report associated text enhancement below.
|
Report associated text enhancement below.
|
||||||
|
|
||||||
Additionally, with this mode, events for pressing modifier keys are reported.
|
Additionally, with this mode, events for pressing modifier keys are reported.
|
||||||
|
Note that *all* keys are reported as escape codes, including :kbd:`Enter, Tab,
|
||||||
|
Backspace` etc.
|
||||||
|
|
||||||
.. _report_text:
|
.. _report_text:
|
||||||
|
|
||||||
|
|||||||
@ -143,17 +143,16 @@ encode_function_key(const KeyEvent *ev, char *output) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ev->mods.value) {
|
if (!ev->mods.value) {
|
||||||
|
if (!ev->disambiguate && !ev->report_text && key_number == GLFW_FKEY_ESCAPE) SIMPLE("\x1b");
|
||||||
|
if (!ev->report_text) {
|
||||||
switch(key_number) {
|
switch(key_number) {
|
||||||
case GLFW_FKEY_ENTER: SIMPLE("\r");
|
case GLFW_FKEY_ENTER: SIMPLE("\r");
|
||||||
case GLFW_FKEY_ESCAPE: {
|
|
||||||
if (ev->disambiguate) { return encode_csi_string('u', "27", output); }
|
|
||||||
SIMPLE("\x1b");
|
|
||||||
}
|
|
||||||
case GLFW_FKEY_BACKSPACE: SIMPLE("\x7f");
|
case GLFW_FKEY_BACKSPACE: SIMPLE("\x7f");
|
||||||
case GLFW_FKEY_TAB: SIMPLE("\t");
|
case GLFW_FKEY_TAB: SIMPLE("\t");
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (ev->mods.value == ALT && !ev->disambiguate) {
|
if (ev->mods.value == ALT && !ev->disambiguate) {
|
||||||
switch(key_number) {
|
switch(key_number) {
|
||||||
case GLFW_FKEY_TAB: SIMPLE("\x1b\t");
|
case GLFW_FKEY_TAB: SIMPLE("\x1b\t");
|
||||||
|
|||||||
@ -437,6 +437,9 @@ class TestKeys(BaseTest):
|
|||||||
ae(kq(ord('a'), mods=ctrl), csi(ctrl, num='a'))
|
ae(kq(ord('a'), mods=ctrl), csi(ctrl, num='a'))
|
||||||
ae(kq(defines.GLFW_FKEY_UP), '\x1b[A')
|
ae(kq(defines.GLFW_FKEY_UP), '\x1b[A')
|
||||||
ae(kq(defines.GLFW_FKEY_LEFT_SHIFT), csi(num=defines.GLFW_FKEY_LEFT_SHIFT))
|
ae(kq(defines.GLFW_FKEY_LEFT_SHIFT), csi(num=defines.GLFW_FKEY_LEFT_SHIFT))
|
||||||
|
ae(kq(defines.GLFW_FKEY_ENTER), '\x1b[13u')
|
||||||
|
ae(kq(defines.GLFW_FKEY_TAB), '\x1b[9u')
|
||||||
|
ae(kq(defines.GLFW_FKEY_BACKSPACE), '\x1b[127u')
|
||||||
|
|
||||||
# test embed text
|
# test embed text
|
||||||
eq = partial(enc, key_encoding_flags=0b11000)
|
eq = partial(enc, key_encoding_flags=0b11000)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
from kitty.config import defaults
|
from kitty.config import defaults
|
||||||
from kitty.constants import WindowGeometry
|
from kitty.types import WindowGeometry
|
||||||
from kitty.layout.interface import Grid, Horizontal, Splits, Stack, Tall
|
from kitty.layout.interface import Grid, Horizontal, Splits, Stack, Tall
|
||||||
from kitty.window import EdgeWidths
|
from kitty.window import EdgeWidths
|
||||||
from kitty.window_list import WindowList, reset_group_id_counter
|
from kitty.window_list import WindowList, reset_group_id_counter
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user