-
Notifications
You must be signed in to change notification settings - Fork 92
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
feat: add Colemak-DH key mapping #414
Conversation
The downside of this PR is the ABI break for keyboard enum, see #412. |
aca4637
to
d7b0f55
Compare
Update PR for #412 so that it will not break the ABI. |
You probably need to resolve the merge conflict so CI can run. |
d7b0f55
to
4e865e5
Compare
Thanks, rebased. |
4e865e5
to
1c11ec8
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #414 +/- ##
==========================================
+ Coverage 79.66% 79.69% +0.03%
==========================================
Files 59 61 +2
Lines 11444 11466 +22
==========================================
+ Hits 9117 9138 +21
- Misses 2327 2328 +1 ☔ View full report in Codecov by Sentry. |
@mlouielu would you be interested to also add Colemak key mapping to the Rust implementation? For now I think you only need to update here to let the tests pass. libchewing/src/editor/syllable/mod.rs Lines 48 to 141 in 1c11ec8
|
Yep, doing that right now! |
7c032c9
to
67b92d3
Compare
src/capi/io.rs
Outdated
KB::ColemakDhAnsi => (AnyKeyboardLayout::qwerty(), Box::new(Standard::new())), | ||
KB::ColemakDhOrth => (AnyKeyboardLayout::qwerty(), Box::new(Standard::new())), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this will map Colemak to QWERTY. This doesn't block merging your PR because we don't really have a test yet and Rust is not release blocking.
If you want to fix it you need to add a new definition like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me try to add it, are there anyway to test if my impl is correct or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, I'm not sure if I can add it correctly, because colemak-dh orth keyboard layout can depend on the user, they only defined 40 keys in it.
(figure from: https://colemakmods.github.io/mod-dh/keyboards.html)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add some tests to test/test-bopomofo.c
test_KB()
If you have rust installed locally you can switch to build and test rust with
cmake --preset rust
cmake --build out/build/rust -t all test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate more on the KeyboardLayout
, how will it affect others?
For example, Colemak-DH Orth didn't define -
in the layout, what will happen if I replace them with Unknown
? And, if the user has different layout than the KEYCODE_INDEX
(e.g. I define my -
at mod+t, not at a regular place), will that also affect the output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, I'm not sure if I can add it correctly, because colemak-dh orth keyboard layout can depend on the user, they only defined 40 keys in it.
Yeah, the current design assumed the keyboard is a variation of the us-102 keyboard. Ortholinear keyboard should still work if you leave the other keys in the same place as us-102.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate more on the
KeyboardLayout
, how will it affect others?
KeyboardLayout is used to map key codes to bopomofo key symbols. Some bopomofo keyboard like Standard only look at the key index to determine it's ㄅ or ㄆ or ㄇ.
For example, Colemak-DH Orth didn't define
-
in the layout, what will happen if I replace them withUnknown
? And, if the user has different layout than theKEYCODE_INDEX
(e.g. I define my-
at mod+t, not at a regular place), will that also affect the output?
I guess as long as you keep the -
in the same place in the KEYCODE_INDEX
it should be fine. No other code currently uses position dependent keymaps for other symbols.
Yeah, I realize the current design doesn't work well for ortholiner keyboard. I have plans to refactor the keymap module but this isn't the priority for now. If it doesn't work I'm can merge your PR just fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in rust & add basic tests
67b92d3
to
64ff57c
Compare
Impl #413