Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: panic when using CJK input methods in macOS #91

Merged
merged 2 commits into from
Mar 9, 2023
Merged

Conversation

werifu
Copy link
Contributor

@werifu werifu commented Dec 16, 2022

Related issue and comment: #86 (comment)

When I am using a Chinese/Japanese input methods, TISCopyCurrentKeyboardInputSource would return NULL, leading to a segment fault in CFDataGetBytePtr(layout) because layout is NULL.

image

So I handled this case by using TISCopyCurrentKeyboardLayoutInputSource, inspired by a similar case in VSCode.
related issue: microsoft/vscode#23833 (comment)
and code: https://github.com/microsoft/node-native-keymap/blob/089d802efd387df4dce1f0e31898c66e28b3f67f/src/keyboard_mac.mm#L87

image

My environment:
MacOS 12.5 (Apple Silicon)
Rust 1.62.1

@CcSimple
Copy link

CcSimple commented Mar 9, 2023

It's very useful for me
thanks @werifu

@Narsil
Copy link
Owner

Narsil commented Mar 9, 2023

Ok, I cannot verify this atm, but having approval from another member of the community is good enough for me ! Merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants