-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Bug] Overlapping combos with different timeouts #1944
Comments
Update: I could confirm the behavior is indeed a bug with this test case I just wrote I'll see if I can find a fix, but again, it's the first time in 15 years that I see C code, so if anyone else sees this and notices it's a quick fix, I'd appreciate the help 🙂 If it's a complex fix, no worries, I don't think it's a super high priority bug. Also, I noticed the tests, at least in the combo folder, don't test the timings at all. I tried to modify the sed command to capture the timestamp, but it doesn't work. This sed:
The timestamp info is still missing. Any idea how to capture the timestamp so I include it in the snapshot? |
Edit: This example is invalid, see below: #1944 (comment)Update I found a way to test the timeouts without having access to the timestamps. I've reworked the test with a working assertion snapshot to illustrate the bug Everything is explained in the test itself, but to make it easier to follow, I'll copy paste the description here
|
Update I found and fixed the bug. I'm verifying just one last assumption, running all the tests, and I'll create PR (might be tomorrow) |
I think there is a somewhat important consideration to be made here: is the physical key press order something that should be preserved or not? I've been working on rolling combos support for the past few weeks and I came across the same issue. My initial implementation did not preserve the physical press order and thus one of the current tests is failing. I'm making another attempt, but this time my goal is to make sure that physical key press order is preserved (combo is placed at first pressed key position). Another aspect I see here is what I would call "combo preferred" behavior that should probably be optional. I do not know how waiting for the longest combo will affect other behaviors that might overlap with the the combos. In your use case, what happens if there is another behavior that will activate on the first A press and now you move it to after the D? |
@vvv-ca That is a very good point! And it is the reason my "verifying just one last assumption" is taking so long 😅 I agree with you that my test shouldn't pass as I described it in the message above. The behavior my test is expecting would indeed be a bug. Good catch! Thanks to your comment, and some more investigation, this is the behavior I would expect in the scenario described above:
That means I can't use my "extra key hack" to go around the fact we don't have access to the "log timestamp" in the golden master snapshot. For now, I'll focus on finding a fix to the bug, I'll think about how to test it properly later. However, my use-case doesn't involve using this extra key. It was only for testing purposes. My use-case is simply to allow different timeout for different combos, and when they share the same key, the longest timeout should be used, not the shortest. And yes, any interrupt in un-related key should 100% interrupt said timeout (my example overlooked that part). The fix I found would indeed break the intended behavior, so I'm very glad you brought that up. Now however, I'm all set up with debug environment, quick feedback loop, etc... So my workflow is much much better than when I first discovered this issue. So, while I didn't find a proper fix as I originally thought, I'll still spend some time to see if I can find a better solution. Probably tomorrow though. I'll share my progress if I have anything. I'll check your code later for inspiration, thanks for sharing. |
Update
|
Hi,
I'm having an issue with overlapping combo with different timeouts. What I want to achieve is to have different timeouts for combos that are using keys on one hand only vs combos that requires two hands to activate. That way I can have 2-hands combos that are easier to trigger, while still keeping a short timeout for 1-hand combos so fast typing doesn't activate the combo.
Unfortunately, I think there is a bug in how the combo timeout are processed (see Context & The Problem). I did try to put a lot of logging try figure out what is going on, but I am not a C/C++ developer, and after spending 4hours trying to figure it out I didn't get very far. I really struggled with logging struct, or arrays. So the progress was excruciatingly slow 😬
That being said, I'd be more than happy to run local experiments if you need more info to isolate the issue
The Problem
Context
20
OneHandLeft
is:20 21
with a timeout of2000
(large for debug purposes)TwoHands
is:20 29
with a timeout of4000
(large for debug purposes)The Issue
Expected
20
, I would expect the key to wait for all associated combo timeouts to expire before deciding that no combo is a match.4000ms
have passedActual Behavior
2000ms
after the key was pressed.Real World Example
I'm using this example keymap on this setup:
five_column_transform
)corne.keymap
The text was updated successfully, but these errors were encountered: