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(macro): keep macro states on macro completion #1243

Merged
merged 1 commit into from
Sep 22, 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
5 changes: 0 additions & 5 deletions keyberon/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1354,11 +1354,6 @@ impl<'a, const C: usize, const R: usize, T: 'a + Copy + std::fmt::Debug> Layout<
// Process it (SequenceEvent)
match seq.cur_event {
Some(SequenceEvent::Complete) => {
for fake_key in self.states.clone().iter() {
if let FakeKey { keycode } = *fake_key {
self.states.retain(|s| s.seq_release(keycode).is_some());
}
}
seq.remaining_events = &[];
}
Some(SequenceEvent::Press(keycode)) => {
Expand Down
26 changes: 26 additions & 0 deletions src/tests/sim_tests/chord_sim_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,29 @@ fn sim_chord_release_nonchord_key_has_correct_order() {
result
);
}

#[test]
fn sim_chord_simultaneous_macro() {
let result = simulate(
"
(defsrc a b o)
(deflayer default
(chord base a)
(chord base b)
(chord base o)
)
(defchords base 500
(a) (macro a z)
(b) (macro b)
(o) o
(a o) o
)
",
"d:a t:10 d:b t:500",
)
.to_ascii();
assert_eq!(
"t:502ms dn:A dn:B t:1ms up:A up:B t:1ms dn:Z t:1ms up:Z",
result
);
}
Loading