Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/siwin/platforms/cocoa/window.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down