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 crash when using Japanese thumb-key (fixes #858) #861

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

glm4610
Copy link
Contributor

@glm4610 glm4610 commented Apr 25, 2024

The bug was introduced in commit 0ab4b98 (Implement Drag-and-return & Circular drag (#854)). It was caused by an assumption that the numeric mode of a layout would have at least a one-to-one relation to its main or shifted modes. In this case, the Japanese main/shifted modes have more keys than the numeric mode, which caused an index error.

KeyboardMode.MAIN, KeyboardMode.SHIFTED -> keyboardDefinition.modes.numeric.arr[i][j]
KeyboardMode.MAIN, KeyboardMode.SHIFTED ->
keyboardDefinition.modes.numeric.arr
.getOrNull(i)?.getOrNull(j)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this for the one above on line 441 also, because not all keyboards have a shifted / opposite mode either.

The bug was introduced in commit 0ab4b98 (Implement Drag-and-return & Circular drag (dessalines#854)). It was caused by an assumption that the numeric mode of a layout would have at least a one-to-one relation to its main or shifted modes. In this case, the Japanese main/shifted modes have more keys than the numeric mode, which caused an index error.
Copy link
Owner

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thx!

@dessalines dessalines merged commit c77c1c5 into dessalines:main Apr 25, 2024
1 check passed
@glm4610 glm4610 deleted the japanese-crash-fix branch May 17, 2024 18:37
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.

2 participants