From a93ee087681f60f6c7bb3479652a0739f578dca5 Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Sat, 7 Mar 2026 13:07:25 -0700 Subject: [PATCH] don't route navigation/editing keys --- src/siwin/platforms/cocoa/window.nim | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/siwin/platforms/cocoa/window.nim b/src/siwin/platforms/cocoa/window.nim index f5e9931..2629642 100644 --- a/src/siwin/platforms/cocoa/window.nim +++ b/src/siwin/platforms/cocoa/window.nim @@ -1346,9 +1346,23 @@ proc init = modifiers: modifiers, ) - # Let key events handle deletion keys directly; routing them through - # NSTextInputClient commands can suppress subsequent key presses. - let shouldRouteToInputContext = key notin [Key.backspace, Key.del] + # Let key events handle navigation/editing control keys directly; + # routing them through NSTextInputClient can suppress following key presses. + let shouldRouteToInputContext = key notin { + Key.backspace, + Key.del, + Key.left, + Key.right, + Key.up, + Key.down, + Key.home, + Key.End, + Key.pageUp, + Key.pageDown, + Key.tab, + Key.enter, + Key.escape, + } if window.eventsHandler.onTextInput != nil and shouldRouteToInputContext: var handledByInputContext = false let inputContext = cast[NSView](self).inputContext