Coder Social home page Coder Social logo

Comments (6)

kovidgoyal avatar kovidgoyal commented on May 28, 2024

Does not reproduce for me: Running with GB layout as

kitty --config=NONE --debug-input kitten show-key

Pressing control+backtick (key to the left of 1) gives me backtick, as expected. Pressing control+\ (key to the right of ] and above return gives ^\ as expected.

Note that different terminals map control+backtick to different things, kitty maps it to backtick in legacy encoding. For proper usage of control+backtick use the kitty keyboard protocol, for example:

kitty kitten show-key -m kitty

from kitty.

dmayle avatar dmayle commented on May 28, 2024

Upon further testing, the problem is only with the GBPC layout, and can be observed both with an ISO keyboard and with an ANSI keyboard.

I've run a test protocol, using kitty --config=NONE --debug-input kitten show-key.

This test uses two different physical keyboards, the first one an ISO GB keyboard, the second is an ANSI US keyboard.

For each keyboard, I test three different layouts: US, GB, GBPC

For the ISO keyboard, I test three physical keys: Non-US Backslash, Non-US Hash, Backtick

For the ANSI keyboard, I test two physical keys: Backslash, backtick

The six Control-Backslash events are isolated here (full test below):

ISO Keyboard, GBPC Layout

NSEvent: type=KeyDown loc=(264.891,880.035) time=404767.7 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=50
Press: native_key: 0x32 (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	insertText: ` replacementRange: (9223372036854775807, 0)
text: 0x60 glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x32 action: PRESS mods: ctrl text: '`' state: 0 sent key as text to child: `

ISO Keyboard, GB Layout

NSEvent: type=KeyDown loc=(453.625,-537.168) time=404722.1 flags=0x40101 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=42
Press: native_key: 0x2a (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x2a action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x1c

ISO Keyboard, US Layout

NSEvent: type=KeyDown loc=(-185.992,502.531) time=404660.3 flags=0x40101 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=42
Press: native_key: 0x2a (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x2a action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x1c

US Keyboard, GBPC Layout

NSEvent: type=KeyDown loc=(1032.05,779.535) time=404194.1 flags=0x40101 win=0x11265dbb0 winNum=13515 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=50
Press: native_key: 0x32 (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	insertText: ` replacementRange: (9223372036854775807, 0)
text: 0x60 glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x32 action: PRESS mods: ctrl text: '`' state: 0 sent key as text to child: `

US Keyboard, GB Layout

NSEvent: type=KeyDown loc=(888.48,215.695) time=404131.2 flags=0x40101 win=0x138e0cb60 winNum=13492 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=42
Press: native_key: 0x2a (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x2a action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x1c

US Keyboard, US Layout

NSEvent: type=KeyDown loc=(1146.28,953.531) time=404251.3 flags=0x40101 win=0x13577a020 winNum=13535 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=42
Press: native_key: 0x2a (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x2a action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x1c

##############################################

For my ISO keyboard, I test with three physical keys:
NUBS = Non-US Backslash
NUHS = Non-US Hash
Backtick

ISO Keyboard, GBPC Layout:
NUBS -> Seen as '\'
Backtick -> Seen as '`'
NUHS -> Seen as '#'

Test pattern:
(Logical backslash/physical NUBS) -> Unmodified, then Control-modified
(Logical backtick/physical backtick) -> Unmodified, then Control-modified
(Logical hash/physical NUHS) -> Unmodified, then Control-modified

$ /Applications/kitty.app/Contents/MacOS/kitty --config=NONE --debug-input kitten show-key
on_focus_change: window id: 0x1 focused: 1
Move x: 264.9 y: 171.0 grabbed: 0
---------------- key down -------------------
NSEvent: type=KeyDown loc=(264.891,880.035) time=404766.7 flags=0x100 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="\" unmodchars="\" repeat=0 keyCode=50
Press: native_key: 0x32 (\) glfw_key: 0x5c mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: \ replacementRange: (9223372036854775807, 0)
text: 0x5c glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x32 action: PRESS mods: none text: '\' state: 0 sent key as text to child: \
----------------- key up --------------------
NSEvent: type=KeyUp loc=(264.891,880.035) time=404766.8 flags=0x100 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="\" unmodchars="\" repeat=0 keyCode=50
Release: native_key: 0x32 (\) glfw_key: 0x5c mods: none
on_key_input: glfw key: 0x5c native_code: 0x32 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(264.891,880.035) time=404767.5 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(264.891,880.035) time=404767.7 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=50
Press: native_key: 0x32 (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	insertText: ` replacementRange: (9223372036854775807, 0)
text: 0x60 glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x32 action: PRESS mods: ctrl text: '`' state: 0 sent key as text to child: `
----------------- key up --------------------
NSEvent: type=KeyUp loc=(264.891,880.035) time=404767.8 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=50
Release: native_key: 0x32 (\) glfw_key: 0x5c mods: ctrl
on_key_input: glfw key: 0x5c native_code: 0x32 action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(264.891,880.035) time=404767.8 flags=0x100 win=0x154eb09b0 winNum=13655 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(264.891,880.035) time=404768.7 flags=0x100 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=10
Press: native_key: 0xa (`) glfw_key: 0x60 mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: ` replacementRange: (9223372036854775807, 0)
text: 0x60 glfw_key: ` marked_text: ()
on_key_input: glfw key: 0x60 native_code: 0xa action: PRESS mods: none text: '`' state: 0 sent key as text to child: `
----------------- key up --------------------
NSEvent: type=KeyUp loc=(264.891,880.035) time=404768.8 flags=0x100 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=10
Release: native_key: 0xa (`) glfw_key: 0x60 mods: none
on_key_input: glfw key: 0x60 native_code: 0xa action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(264.891,880.035) time=404769.3 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(264.891,880.035) time=404769.5 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="0" unmodchars="`" repeat=0 keyCode=10
Press: native_key: 0xa (`) glfw_key: 0x60 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: ` marked_text: ()
on_key_input: glfw key: 0x60 native_code: 0xa action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: `
----------------- key up --------------------
NSEvent: type=KeyUp loc=(264.891,880.035) time=404769.6 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="0" unmodchars="`" repeat=0 keyCode=10
Release: native_key: 0xa (`) glfw_key: 0x60 mods: ctrl
on_key_input: glfw key: 0x60 native_code: 0xa action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(264.891,880.035) time=404769.6 flags=0x100 win=0x154eb09b0 winNum=13655 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(264.891,880.035) time=404770.4 flags=0x100 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="#" unmodchars="#" repeat=0 keyCode=42
Press: native_key: 0x2a (#) glfw_key: 0x23 mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: # replacementRange: (9223372036854775807, 0)
text: 0x23 glfw_key: # marked_text: ()
on_key_input: glfw key: 0x23 native_code: 0x2a action: PRESS mods: none text: '#' state: 0 sent key as text to child: #
----------------- key up --------------------
NSEvent: type=KeyUp loc=(264.891,880.035) time=404770.5 flags=0x100 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="#" unmodchars="#" repeat=0 keyCode=42
Release: native_key: 0x2a (#) glfw_key: 0x23 mods: none
on_key_input: glfw key: 0x23 native_code: 0x2a action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(264.891,880.035) time=404771.1 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(264.891,880.035) time=404771.3 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="" unmodchars="#" repeat=0 keyCode=42
Press: native_key: 0x2a (#) glfw_key: 0x23 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: # marked_text: ()
on_key_input: glfw key: 0x23 native_code: 0x2a action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: #
----------------- key up --------------------
NSEvent: type=KeyUp loc=(264.891,880.035) time=404771.4 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="" unmodchars="#" repeat=0 keyCode=42
Release: native_key: 0x2a (#) glfw_key: 0x23 mods: ctrl
on_key_input: glfw key: 0x23 native_code: 0x2a action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(264.891,880.035) time=404771.5 flags=0x100 win=0x154eb09b0 winNum=13655 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(264.891,880.035) time=404772.6 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(264.891,880.035) time=404773.0 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="" unmodchars="d" repeat=0 keyCode=2
Press: native_key: 0x2 (d) glfw_key: 0x64 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (deleteForward:)
text: <none> glfw_key: d marked_text: ()
on_key_input: glfw key: 0x64 native_code: 0x2 action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x4
----------------- key up --------------------
NSEvent: type=KeyUp loc=(1922.89,1471.04) time=404773.1 flags=0x40101 win=0x0 winNum=0 ctxt=0x0 chars="" unmodchars="d" repeat=0 keyCode=2
keyUp ignored as no keyWindow present
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1922.89,1471.04) time=404773.1 flags=0x100 win=0x0 winNum=0 ctxt=0x0 keyCode=59
flagsChanged ignored as no keyWindow present

ISO Keyboard, GB Layout:
NUBS -> Seen as '`'
Backtick -> Seen as '§'
NUHS -> Seen as '\'

Test pattern:
(Logical backslash/physical NUHS) -> Unmodified, then Control-modified
(Logical backtick/physical NUBS) -> Unmodified, then Control-modified
(Logical section/physical backtick) -> Unmodified, then Control-modified

$ /Applications/kitty.app/Contents/MacOS/kitty --config=NONE --debug-input kitten show-key
on_focus_change: window id: 0x1 focused: 1
---------------- key down -------------------
NSEvent: type=KeyDown loc=(453.625,-537.168) time=404721.2 flags=0x100 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="\" unmodchars="\" repeat=0 keyCode=42
Press: native_key: 0x2a (\) glfw_key: 0x5c mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: \ replacementRange: (9223372036854775807, 0)
text: 0x5c glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x2a action: PRESS mods: none text: '\' state: 0 sent key as text to child: \
----------------- key up --------------------
NSEvent: type=KeyUp loc=(453.625,-537.168) time=404721.2 flags=0x100 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="\" unmodchars="\" repeat=0 keyCode=42
Release: native_key: 0x2a (\) glfw_key: 0x5c mods: none
on_key_input: glfw key: 0x5c native_code: 0x2a action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(453.625,-537.168) time=404721.8 flags=0x40101 win=0x10974ddf0 winNum=13636 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(453.625,-537.168) time=404722.1 flags=0x40101 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=42
Press: native_key: 0x2a (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x2a action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x1c
----------------- key up --------------------
NSEvent: type=KeyUp loc=(453.625,-537.168) time=404722.2 flags=0x40101 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=42
Release: native_key: 0x2a (\) glfw_key: 0x5c mods: ctrl
on_key_input: glfw key: 0x5c native_code: 0x2a action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(453.625,-537.168) time=404722.3 flags=0x100 win=0x10974ddf0 winNum=13636 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(453.625,-537.168) time=404723.0 flags=0x100 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Press: native_key: 0x32 (`) glfw_key: 0x60 mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: ` replacementRange: (9223372036854775807, 0)
text: 0x60 glfw_key: ` marked_text: ()
on_key_input: glfw key: 0x60 native_code: 0x32 action: PRESS mods: none text: '`' state: 0 sent key as text to child: `
----------------- key up --------------------
NSEvent: type=KeyUp loc=(453.625,-537.168) time=404723.1 flags=0x100 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Release: native_key: 0x32 (`) glfw_key: 0x60 mods: none
on_key_input: glfw key: 0x60 native_code: 0x32 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(453.625,-537.168) time=404723.6 flags=0x40101 win=0x10974ddf0 winNum=13636 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(453.625,-537.168) time=404723.9 flags=0x40101 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Press: native_key: 0x32 (`) glfw_key: 0x60 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: ` marked_text: ()
on_key_input: glfw key: 0x60 native_code: 0x32 action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: `
----------------- key up --------------------
NSEvent: type=KeyUp loc=(453.625,-537.168) time=404724.0 flags=0x40101 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Release: native_key: 0x32 (`) glfw_key: 0x60 mods: ctrl
on_key_input: glfw key: 0x60 native_code: 0x32 action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(453.625,-537.168) time=404724.0 flags=0x100 win=0x10974ddf0 winNum=13636 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(453.625,-537.168) time=404725.9 flags=0x100 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="§" unmodchars="§" repeat=0 keyCode=10
Press: native_key: 0xa (§) glfw_key: 0xa7 mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: § replacementRange: (9223372036854775807, 0)
text: 0xc2 0xa7 glfw_key: § marked_text: ()
on_key_input: glfw key: 0xa7 native_code: 0xa action: PRESS mods: none text: '§' state: 0 sent key as text to child: §
----------------- key up --------------------
NSEvent: type=KeyUp loc=(453.625,-537.168) time=404726.0 flags=0x100 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="§" unmodchars="§" repeat=0 keyCode=10
Release: native_key: 0xa (§) glfw_key: 0xa7 mods: none
on_key_input: glfw key: 0xa7 native_code: 0xa action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(453.625,-537.168) time=404726.7 flags=0x40101 win=0x10974ddf0 winNum=13636 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(453.625,-537.168) time=404726.9 flags=0x40101 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="`" unmodchars="§" repeat=0 keyCode=10
Press: native_key: 0xa (§) glfw_key: 0xa7 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: § marked_text: ()
on_key_input: glfw key: 0xa7 native_code: 0xa action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: ^[ [ 1 6 7 ; 5 u
----------------- key up --------------------
NSEvent: type=KeyUp loc=(453.625,-537.168) time=404727.0 flags=0x40101 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="`" unmodchars="§" repeat=0 keyCode=10
Release: native_key: 0xa (§) glfw_key: 0xa7 mods: ctrl
on_key_input: glfw key: 0xa7 native_code: 0xa action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(453.625,-537.168) time=404727.0 flags=0x100 win=0x10974ddf0 winNum=13636 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(453.625,-537.168) time=404728.5 flags=0x40101 win=0x10974ddf0 winNum=13636 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(453.625,-537.168) time=404728.6 flags=0x40101 win=0x10974ddf0 winNum=13636 ctxt=0x0 chars="" unmodchars="d" repeat=0 keyCode=2
Press: native_key: 0x2 (d) glfw_key: 0x64 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (deleteForward:)
text: <none> glfw_key: d� marked_text: ()
on_key_input: glfw key: 0x64 native_code: 0x2 action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x4
----------------- key up --------------------
NSEvent: type=KeyUp loc=(2111.62,53.832) time=404728.7 flags=0x40101 win=0x0 winNum=0 ctxt=0x0 chars="" unmodchars="d" repeat=0 keyCode=2
keyUp ignored as no keyWindow present
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(2111.62,53.832) time=404728.8 flags=0x100 win=0x0 winNum=0 ctxt=0x0 keyCode=59
flagsChanged ignored as no keyWindow present

ISO Keyboard, US ANSI Layout:
NUBS -> Seen as '`'
Backtick -> Seen as '§'
NUHS -> Seen as '\'

Test pattern:
(Logical backslash/physical NUHS) -> Unmodified, then Control-modified
(Logical backtick/physical NUBS) -> Unmodified, then Control-modified
(Logical section/physical backtick) -> Unmodified, then Control-modified

$ /Applications/kitty.app/Contents/MacOS/kitty --config=NONE --debug-input kitten show-key
on_focus_change: window id: 0x1 focused: 1
---------------- key down -------------------
NSEvent: type=KeyDown loc=(-185.992,502.531) time=404659.4 flags=0x100 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="\" unmodchars="\" repeat=0 keyCode=42
Press: native_key: 0x2a (\) glfw_key: 0x5c mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: \ replacementRange: (9223372036854775807, 0)
text: 0x5c glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x2a action: PRESS mods: none text: '\' state: 0 sent key as text to child: \
----------------- key up --------------------
NSEvent: type=KeyUp loc=(-185.992,502.531) time=404659.5 flags=0x100 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="\" unmodchars="\" repeat=0 keyCode=42
Release: native_key: 0x2a (\) glfw_key: 0x5c mods: none
on_key_input: glfw key: 0x5c native_code: 0x2a action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(-185.992,502.531) time=404660.1 flags=0x40101 win=0x1602af7e0 winNum=13618 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(-185.992,502.531) time=404660.3 flags=0x40101 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=42
Press: native_key: 0x2a (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x2a action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x1c
----------------- key up --------------------
NSEvent: type=KeyUp loc=(-185.992,502.531) time=404660.4 flags=0x40101 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=42
Release: native_key: 0x2a (\) glfw_key: 0x5c mods: ctrl
on_key_input: glfw key: 0x5c native_code: 0x2a action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(-185.992,502.531) time=404660.5 flags=0x100 win=0x1602af7e0 winNum=13618 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(-185.992,502.531) time=404662.3 flags=0x100 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Press: native_key: 0x32 (`) glfw_key: 0x60 mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: ` replacementRange: (9223372036854775807, 0)
text: 0x60 glfw_key: ` marked_text: ()
on_key_input: glfw key: 0x60 native_code: 0x32 action: PRESS mods: none text: '`' state: 0 sent key as text to child: `
----------------- key up --------------------
NSEvent: type=KeyUp loc=(-185.992,502.531) time=404662.4 flags=0x100 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Release: native_key: 0x32 (`) glfw_key: 0x60 mods: none
on_key_input: glfw key: 0x60 native_code: 0x32 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(-185.992,502.531) time=404663.7 flags=0x40101 win=0x1602af7e0 winNum=13618 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(-185.992,502.531) time=404663.9 flags=0x40101 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Press: native_key: 0x32 (`) glfw_key: 0x60 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: ` marked_text: ()
on_key_input: glfw key: 0x60 native_code: 0x32 action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: `
----------------- key up --------------------
NSEvent: type=KeyUp loc=(-185.992,502.531) time=404664.0 flags=0x40101 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Release: native_key: 0x32 (`) glfw_key: 0x60 mods: ctrl
on_key_input: glfw key: 0x60 native_code: 0x32 action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(-185.992,502.531) time=404664.1 flags=0x100 win=0x1602af7e0 winNum=13618 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(-185.992,502.531) time=404665.1 flags=0x100 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="§" unmodchars="§" repeat=0 keyCode=10
Press: native_key: 0xa (§) glfw_key: 0xa7 mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: § replacementRange: (9223372036854775807, 0)
text: 0xc2 0xa7 glfw_key: § marked_text: ()
on_key_input: glfw key: 0xa7 native_code: 0xa action: PRESS mods: none text: '§' state: 0 sent key as text to child: §
----------------- key up --------------------
NSEvent: type=KeyUp loc=(-185.992,502.531) time=404665.2 flags=0x100 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="§" unmodchars="§" repeat=0 keyCode=10
Release: native_key: 0xa (§) glfw_key: 0xa7 mods: none
on_key_input: glfw key: 0xa7 native_code: 0xa action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(-185.992,502.531) time=404666.0 flags=0x40101 win=0x1602af7e0 winNum=13618 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(-185.992,502.531) time=404666.2 flags=0x40101 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="0" unmodchars="§" repeat=0 keyCode=10
Press: native_key: 0xa (§) glfw_key: 0xa7 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: § marked_text: ()
on_key_input: glfw key: 0xa7 native_code: 0xa action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: ^[ [ 1 6 7 ; 5 u
----------------- key up --------------------
NSEvent: type=KeyUp loc=(-185.992,502.531) time=404666.3 flags=0x40101 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="0" unmodchars="§" repeat=0 keyCode=10
Release: native_key: 0xa (§) glfw_key: 0xa7 mods: ctrl
on_key_input: glfw key: 0xa7 native_code: 0xa action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(-185.992,502.531) time=404666.3 flags=0x100 win=0x1602af7e0 winNum=13618 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(-185.992,502.531) time=404671.1 flags=0x40101 win=0x1602af7e0 winNum=13618 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(-185.992,502.531) time=404671.3 flags=0x40101 win=0x1602af7e0 winNum=13618 ctxt=0x0 chars="" unmodchars="d" repeat=0 keyCode=2
Press: native_key: 0x2 (d) glfw_key: 0x64 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (deleteForward:)
text: <none> glfw_key: d� marked_text: ()
on_key_input: glfw key: 0x64 native_code: 0x2 action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x4
----------------- key up --------------------
NSEvent: type=KeyUp loc=(1472.01,1093.53) time=404671.4 flags=0x40101 win=0x0 winNum=0 ctxt=0x0 chars="" unmodchars="d" repeat=0 keyCode=2
keyUp ignored as no keyWindow present
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1472.01,1093.53) time=404671.5 flags=0x100 win=0x0 winNum=0 ctxt=0x0 keyCode=59
flagsChanged ignored as no keyWindow present

For my US ANSI keyboard, I test with two physical keys:
Backslash
Backtick

US Keyboard, US Layout:
Backslash -> Seen as '\'
Backtick -> Seen as '`'

Test pattern:
(Logical backslash/physical backslash) -> Unmodified, then Control-modified
(Logical backtick/physical backtick) -> Unmodified, then Control-modified

$ /Applications/kitty.app/Contents/MacOS/kitty --config=NONE --debug-input kitten show-key
on_focus_change: window id: 0x1 focused: 1
Move x: 2292.6 y: 194.9 grabbed: 0
---------------- key down -------------------
NSEvent: type=KeyDown loc=(1146.28,953.531) time=404250.6 flags=0x100 win=0x13577a020 winNum=13535 ctxt=0x0 chars="\" unmodchars="\" repeat=0 keyCode=42
Press: native_key: 0x2a (\) glfw_key: 0x5c mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: \ replacementRange: (9223372036854775807, 0)
text: 0x5c glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x2a action: PRESS mods: none text: '\' state: 0 sent key as text to child: \
----------------- key up --------------------
NSEvent: type=KeyUp loc=(1146.28,953.531) time=404250.7 flags=0x100 win=0x13577a020 winNum=13535 ctxt=0x0 chars="\" unmodchars="\" repeat=0 keyCode=42
Release: native_key: 0x2a (\) glfw_key: 0x5c mods: none
on_key_input: glfw key: 0x5c native_code: 0x2a action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1146.28,953.531) time=404251.1 flags=0x40101 win=0x13577a020 winNum=13535 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(1146.28,953.531) time=404251.3 flags=0x40101 win=0x13577a020 winNum=13535 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=42
Press: native_key: 0x2a (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x2a action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x1c
----------------- key up --------------------
NSEvent: type=KeyUp loc=(1146.28,953.531) time=404251.4 flags=0x40101 win=0x13577a020 winNum=13535 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=42
Release: native_key: 0x2a (\) glfw_key: 0x5c mods: ctrl
on_key_input: glfw key: 0x5c native_code: 0x2a action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1146.28,953.531) time=404251.5 flags=0x100 win=0x13577a020 winNum=13535 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(1146.28,953.531) time=404252.4 flags=0x100 win=0x13577a020 winNum=13535 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Press: native_key: 0x32 (`) glfw_key: 0x60 mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: ` replacementRange: (9223372036854775807, 0)
text: 0x60 glfw_key: ` marked_text: ()
on_key_input: glfw key: 0x60 native_code: 0x32 action: PRESS mods: none text: '`' state: 0 sent key as text to child: `
----------------- key up --------------------
NSEvent: type=KeyUp loc=(1146.28,953.531) time=404252.5 flags=0x100 win=0x13577a020 winNum=13535 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Release: native_key: 0x32 (`) glfw_key: 0x60 mods: none
on_key_input: glfw key: 0x60 native_code: 0x32 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1146.28,953.531) time=404253.6 flags=0x40101 win=0x13577a020 winNum=13535 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(1146.28,953.531) time=404253.8 flags=0x40101 win=0x13577a020 winNum=13535 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Press: native_key: 0x32 (`) glfw_key: 0x60 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: ` marked_text: ()
on_key_input: glfw key: 0x60 native_code: 0x32 action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: `
----------------- key up --------------------
NSEvent: type=KeyUp loc=(1146.28,953.531) time=404253.9 flags=0x40101 win=0x13577a020 winNum=13535 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Release: native_key: 0x32 (`) glfw_key: 0x60 mods: ctrl
on_key_input: glfw key: 0x60 native_code: 0x32 action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1146.28,953.531) time=404253.9 flags=0x100 win=0x13577a020 winNum=13535 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1146.28,953.531) time=404255.1 flags=0x40101 win=0x13577a020 winNum=13535 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(1146.28,953.531) time=404255.3 flags=0x40101 win=0x13577a020 winNum=13535 ctxt=0x0 chars="" unmodchars="d" repeat=0 keyCode=2
Press: native_key: 0x2 (d) glfw_key: 0x64 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (deleteForward:)
text: <none> glfw_key: d marked_text: ()
on_key_input: glfw key: 0x64 native_code: 0x2 action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x4
----------------- key up --------------------
NSEvent: type=KeyUp loc=(1160.28,953.531) time=404255.4 flags=0x40101 win=0x0 winNum=0 ctxt=0x0 chars="" unmodchars="d" repeat=0 keyCode=2
keyUp ignored as no keyWindow present
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1160.28,953.531) time=404255.5 flags=0x100 win=0x0 winNum=0 ctxt=0x0 keyCode=59
flagsChanged ignored as no keyWindow present

US Keyboard, GBPC Layout:
Backslash -> Seen as '#'
Backtick -> Seen as '\'

Test pattern:
(Logical backslash/physical backtick) -> Unmodified, then Control-modified
(Logical hash/physical backslash) -> Unmodified, then Control-modified

$ /Applications/kitty.app/Contents/MacOS/kitty --config=NONE --debug-input kitten show-key
on_focus_change: window id: 0x1 focused: 1
Move x: 2064.1 y: 542.9 grabbed: 0
---------------- key down -------------------
NSEvent: type=KeyDown loc=(1032.05,779.535) time=404192.9 flags=0x100 win=0x11265dbb0 winNum=13515 ctxt=0x0 chars="\" unmodchars="\" repeat=0 keyCode=50
Press: native_key: 0x32 (\) glfw_key: 0x5c mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: \ replacementRange: (9223372036854775807, 0)
text: 0x5c glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x32 action: PRESS mods: none text: '\' state: 0 sent key as text to child: \
----------------- key up --------------------
NSEvent: type=KeyUp loc=(1032.05,779.535) time=404193.0 flags=0x100 win=0x11265dbb0 winNum=13515 ctxt=0x0 chars="\" unmodchars="\" repeat=0 keyCode=50
Release: native_key: 0x32 (\) glfw_key: 0x5c mods: none
on_key_input: glfw key: 0x5c native_code: 0x32 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1032.05,779.535) time=404193.7 flags=0x40101 win=0x11265dbb0 winNum=13515 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(1032.05,779.535) time=404194.1 flags=0x40101 win=0x11265dbb0 winNum=13515 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=50
Press: native_key: 0x32 (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	insertText: ` replacementRange: (9223372036854775807, 0)
text: 0x60 glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x32 action: PRESS mods: ctrl text: '`' state: 0 sent key as text to child: `
----------------- key up --------------------
NSEvent: type=KeyUp loc=(1032.05,779.535) time=404194.2 flags=0x40101 win=0x11265dbb0 winNum=13515 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=50
Release: native_key: 0x32 (\) glfw_key: 0x5c mods: ctrl
on_key_input: glfw key: 0x5c native_code: 0x32 action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1032.05,779.535) time=404194.2 flags=0x100 win=0x11265dbb0 winNum=13515 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(1032.05,779.535) time=404195.6 flags=0x100 win=0x11265dbb0 winNum=13515 ctxt=0x0 chars="#" unmodchars="#" repeat=0 keyCode=42
Press: native_key: 0x2a (#) glfw_key: 0x23 mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: # replacementRange: (9223372036854775807, 0)
text: 0x23 glfw_key: # marked_text: ()
on_key_input: glfw key: 0x23 native_code: 0x2a action: PRESS mods: none text: '#' state: 0 sent key as text to child: #
----------------- key up --------------------
NSEvent: type=KeyUp loc=(1032.05,779.535) time=404195.7 flags=0x100 win=0x11265dbb0 winNum=13515 ctxt=0x0 chars="#" unmodchars="#" repeat=0 keyCode=42
Release: native_key: 0x2a (#) glfw_key: 0x23 mods: none
on_key_input: glfw key: 0x23 native_code: 0x2a action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1032.05,779.535) time=404196.4 flags=0x40101 win=0x11265dbb0 winNum=13515 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(1032.05,779.535) time=404196.6 flags=0x40101 win=0x11265dbb0 winNum=13515 ctxt=0x0 chars="" unmodchars="#" repeat=0 keyCode=42
Press: native_key: 0x2a (#) glfw_key: 0x23 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: # marked_text: ()
on_key_input: glfw key: 0x23 native_code: 0x2a action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: #
----------------- key up --------------------
NSEvent: type=KeyUp loc=(1032.05,779.535) time=404196.7 flags=0x40101 win=0x11265dbb0 winNum=13515 ctxt=0x0 chars="" unmodchars="#" repeat=0 keyCode=42
Release: native_key: 0x2a (#) glfw_key: 0x23 mods: ctrl
on_key_input: glfw key: 0x23 native_code: 0x2a action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1032.05,779.535) time=404196.8 flags=0x100 win=0x11265dbb0 winNum=13515 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1032.05,779.535) time=404198.6 flags=0x40101 win=0x11265dbb0 winNum=13515 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(1032.05,779.535) time=404198.8 flags=0x40101 win=0x11265dbb0 winNum=13515 ctxt=0x0 chars="" unmodchars="d" repeat=0 keyCode=2
Press: native_key: 0x2 (d) glfw_key: 0x64 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (deleteForward:)
text: <none> glfw_key: d marked_text: ()
on_key_input: glfw key: 0x64 native_code: 0x2 action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x4
----------------- key up --------------------
NSEvent: type=KeyUp loc=(1046.05,779.535) time=404198.9 flags=0x40101 win=0x0 winNum=0 ctxt=0x0 chars="" unmodchars="d" repeat=0 keyCode=2
keyUp ignored as no keyWindow present
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(1046.05,779.535) time=404199.0 flags=0x100 win=0x0 winNum=0 ctxt=0x0 keyCode=59
flagsChanged ignored as no keyWindow present

US Keyboard, GB Layout:
Backslash -> Seen as '\'
Backtick -> Seen as '`'

Test pattern:
(Logical backslash/physical backslash) -> Unmodified, then Control-modified
(Logical backtick/physical backtick) -> Unmodified, then Control-modified

$ /Applications/kitty.app/Contents/MacOS/kitty --config=NONE --debug-input kitten show-key
on_focus_change: window id: 0x1 focused: 1
Move x: 1777.0 y: 1670.6 grabbed: 0
---------------- key down -------------------
NSEvent: type=KeyDown loc=(888.48,215.695) time=404128.3 flags=0x100 win=0x138e0cb60 winNum=13492 ctxt=0x0 chars="\" unmodchars="\" repeat=0 keyCode=42
Press: native_key: 0x2a (\) glfw_key: 0x5c mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: \ replacementRange: (9223372036854775807, 0)
text: 0x5c glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x2a action: PRESS mods: none text: '\' state: 0 sent key as text to child: \
----------------- key up --------------------
NSEvent: type=KeyUp loc=(888.48,215.695) time=404128.4 flags=0x100 win=0x138e0cb60 winNum=13492 ctxt=0x0 chars="\" unmodchars="\" repeat=0 keyCode=42
Release: native_key: 0x2a (\) glfw_key: 0x5c mods: none
on_key_input: glfw key: 0x5c native_code: 0x2a action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(888.48,215.695) time=404130.9 flags=0x40101 win=0x138e0cb60 winNum=13492 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(888.48,215.695) time=404131.2 flags=0x40101 win=0x138e0cb60 winNum=13492 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=42
Press: native_key: 0x2a (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x2a action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x1c
----------------- key up --------------------
NSEvent: type=KeyUp loc=(888.48,215.695) time=404131.3 flags=0x40101 win=0x138e0cb60 winNum=13492 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=42
Release: native_key: 0x2a (\) glfw_key: 0x5c mods: ctrl
on_key_input: glfw key: 0x5c native_code: 0x2a action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(888.48,215.695) time=404131.5 flags=0x100 win=0x138e0cb60 winNum=13492 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(888.48,215.695) time=404132.9 flags=0x100 win=0x138e0cb60 winNum=13492 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Press: native_key: 0x32 (`) glfw_key: 0x60 mods: none char_count: 1 deadKeyState: 0 repeat: 0
	insertText: ` replacementRange: (9223372036854775807, 0)
text: 0x60 glfw_key: ` marked_text: ()
on_key_input: glfw key: 0x60 native_code: 0x32 action: PRESS mods: none text: '`' state: 0 sent key as text to child: `
----------------- key up --------------------
NSEvent: type=KeyUp loc=(888.48,215.695) time=404133.0 flags=0x100 win=0x138e0cb60 winNum=13492 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Release: native_key: 0x32 (`) glfw_key: 0x60 mods: none
on_key_input: glfw key: 0x60 native_code: 0x32 action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(888.48,215.695) time=404133.5 flags=0x40101 win=0x138e0cb60 winNum=13492 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(888.48,215.695) time=404133.7 flags=0x40101 win=0x138e0cb60 winNum=13492 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Press: native_key: 0x32 (`) glfw_key: 0x60 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: ` marked_text: ()
on_key_input: glfw key: 0x60 native_code: 0x32 action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: `
----------------- key up --------------------
NSEvent: type=KeyUp loc=(888.48,215.695) time=404133.8 flags=0x40101 win=0x138e0cb60 winNum=13492 ctxt=0x0 chars="`" unmodchars="`" repeat=0 keyCode=50
Release: native_key: 0x32 (`) glfw_key: 0x60 mods: ctrl
on_key_input: glfw key: 0x60 native_code: 0x32 action: RELEASE mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(888.48,215.695) time=404133.9 flags=0x100 win=0x138e0cb60 winNum=13492 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: none
on_key_input: glfw key: 0xe062 native_code: 0x3b action: RELEASE mods: none text: '' state: 0 ignoring as keyboard mode does not support encoding this event
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(888.48,215.695) time=404135.6 flags=0x40101 win=0x138e0cb60 winNum=13492 ctxt=0x0 keyCode=59
flagsChanged: modifier: ctrl native_key: 0x3b (<noname>) glfw_key: 0xe062 mods: ctrl
on_key_input: glfw key: 0xe062 native_code: 0x3b action: PRESS mods: ctrl text: '' state: 0 ignoring as keyboard mode does not support encoding this event
---------------- key down -------------------
NSEvent: type=KeyDown loc=(888.48,215.695) time=404135.9 flags=0x40101 win=0x138e0cb60 winNum=13492 ctxt=0x0 chars="" unmodchars="d" repeat=0 keyCode=2
Press: native_key: 0x2 (d) glfw_key: 0x64 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (deleteForward:)
text: <none> glfw_key: d marked_text: ()
on_key_input: glfw key: 0x64 native_code: 0x2 action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: 0x4
----------------- key up --------------------
NSEvent: type=KeyUp loc=(902.48,215.695) time=404136.0 flags=0x40101 win=0x0 winNum=0 ctxt=0x0 chars="" unmodchars="d" repeat=0 keyCode=2
keyUp ignored as no keyWindow present
-------------- flags changed -----------------
NSEvent: type=FlagsChanged loc=(902.48,215.695) time=404136.1 flags=0x100 win=0x0 winNum=0 ctxt=0x0 keyCode=59
flagsChanged ignored as no keyWindow present

from kitty.

kovidgoyal avatar kovidgoyal commented on May 28, 2024

On my mac with GBPC layout pressing the backslash key generates # in all
applications including kitty and
pressing the control + backslash key also generates # which is correct
since there is no encoding for ctrl+# in legacy mode.

from kitty.

dmayle avatar dmayle commented on May 28, 2024

This bug report is supposed to be about the handling of control-backslash in the GBPC layout.

If you're using an ISO keyboard with GBPC layout, that key is generated by pressing NUBS, or Non-US Backslash.

If you're using an ANSI keyboard with GBPC layout, that key is generated by pressing the backtick key.

Assuming that you're testing with an ANSI keyboard with GBPC layout, this is the log that comes from pressing control-backtick, which simulates the control-backslash of an ISO keyboard using GBPC layout:

NSEvent: type=KeyDown loc=(1032.05,779.535) time=404194.1 flags=0x40101 win=0x11265dbb0 winNum=13515 ctxt=0x0 chars="" unmodchars="\" repeat=0 keyCode=50
Press: native_key: 0x32 (\) glfw_key: 0x5c mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	insertText: ` replacementRange: (9223372036854775807, 0)
text: 0x60 glfw_key: \ marked_text: ()
on_key_input: glfw key: 0x5c native_code: 0x32 action: PRESS mods: ctrl text: '`' state: 0 sent key as text to child: `

You can see that the unmodchars is seen as backslash, that that the mods: ctrl exists, and yet it is:

sent key as text to child: `

from kitty.

kovidgoyal avatar kovidgoyal commented on May 28, 2024

Because cocoa is calling insertText with ` as the text for that key
event. Nothing kitty can do here, it takes insertText inserting text
as meaning Apple wants the key to insert text, since that is what its
native framework does.

from kitty.

dmayle avatar dmayle commented on May 28, 2024

I verified this by exporting out the two keyboard layouts from the system, and you're absolutely right. The keyboard layout specifies that control-backslash should be treated as a backtick.

Given that, however, I looked through the keyboard mapping to see how control-backslash is actually mapped, and it turns out that the way to generate a control-backslash in this layout is by hitting control-hash.

I verified this by opening Terminal.app and starting cat before hitting control-hash, and the control-backslash character was successfully output.

However, when I opened kitty, I do not get the correct mapping of control-hash pressed to control-backslash output:

NSEvent: type=KeyDown loc=(264.891,880.035) time=404771.3 flags=0x40101 win=0x154eb09b0 winNum=13655 ctxt=0x0 chars="" unmodchars="#" repeat=0 keyCode=42
Press: native_key: 0x2a (#) glfw_key: 0x23 mods: ctrl char_count: 1 deadKeyState: 0 repeat: 0
	TextInputCtx: doCommandBySelector: (noop:)
text: <none> glfw_key: # marked_text: ()
on_key_input: glfw key: 0x23 native_code: 0x2a action: PRESS mods: ctrl text: '' state: 0 sent encoded key to child: #

It seems like the kitty code is "correctly" interpreting all keys that generate insertText, but manually (mis-)interpreting doCommandBySelector based on the original key pressed.

I have a workaround, I will create a custom keymap based off of GBPC (since I never want to use control-backslash to mean backtick).

from kitty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.