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: Release RAlt after zippy-chording #1385

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions src/kanata/output_logic/zippychord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ impl ZchState {
OsCode::KEY_RIGHTSHIFT => {
self.zchd.zchd_is_rsft_active = false;
}
OsCode::KEY_RIGHTALT => {
self.zchd.zchd_is_altgr_active = false;
}
_ => {}
}
if osc.is_zippy_ignored() {
Expand Down
49 changes: 49 additions & 0 deletions src/tests/sim_tests/zippychord_sim_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,55 @@ fn sim_zippychord_rsft() {
);
}

#[test]
fn sim_zippychord_ralt() {
// test ralt behaviour while pressed
let result = simulate_with_zippy_file_content(
ZIPPY_CFG,
"d:ralt t:10 d:d t:10 d:y t:10",
ZIPPY_FILE_CONTENT,
)
.to_ascii();
assert_eq!(
"dn:RAlt t:10ms dn:D t:10ms dn:BSpace up:BSpace up:RAlt up:D dn:D dn:A up:A up:Y dn:Y dn:RAlt",
result
);
let result = simulate_with_zippy_file_content(
ZIPPY_CFG,
"d:ralt t:10 d:x t:10 d:y t:10",
ZIPPY_FILE_CONTENT,
)
.to_ascii();
assert_eq!(
"dn:RAlt t:10ms dn:X t:10ms dn:BSpace up:BSpace \
up:RAlt dn:LShift dn:W up:W up:LShift up:X dn:X dn:LShift up:Y dn:Y up:LShift dn:Z up:Z dn:RAlt",
result
);

// ensure rsft-held behaviour goes away when released
let result = simulate_with_zippy_file_content(
ZIPPY_CFG,
"d:ralt t:10 d:d u:ralt t:10 d:y t:10",
ZIPPY_FILE_CONTENT,
)
.to_ascii();
assert_eq!(
"dn:RAlt t:10ms dn:D t:1ms up:RAlt t:9ms dn:BSpace up:BSpace up:D dn:D dn:A up:A up:Y dn:Y",
result
);
let result = simulate_with_zippy_file_content(
ZIPPY_CFG,
"d:ralt t:10 d:x u:ralt t:10 d:y t:10",
ZIPPY_FILE_CONTENT,
)
.to_ascii();
assert_eq!(
"dn:RAlt t:10ms dn:X t:1ms up:RAlt t:9ms dn:BSpace up:BSpace \
dn:LShift dn:W up:W up:LShift up:X dn:X dn:LShift up:Y dn:Y up:LShift dn:Z up:Z",
result
);
}

#[test]
fn sim_zippychord_caps_word() {
let result = simulate_with_zippy_file_content(
Expand Down