houmain / keymapper

A cross-platform context-aware key remapper.
GNU General Public License v3.0
257 stars 21 forks source link

A strange performance #39

Closed yyy33 closed 1 year ago

yyy33 commented 1 year ago

I'm not very good at English, I don't know if the author can understand what I mean

  1. This is my profile

    CapsLock{H} >> A
    (CapsLock AltLeft) >> B
  2. When I press and hold cpaslock and altleft, then i press H , at this time I receive the character B, which is normal

  3. Release the H key (at this time cpaslock and altleft are still held down), then press and release the H key, at this time I do not receive the character B, but the character A,Shouldn't I still be receiving character B at this point?

  4. change my profile to

    (CapsLock AltLeft) >> B
    CapsLock{H} >> A

5.Everything is behaving normally

houmain commented 1 year ago

I tried your configuration but, sorry I did not notice anything baffling. B is being repeated as long as only CapsLock and AltLeft are hold. Then, when I press H it keeps repeating A. I did not even notice a difference between your two configurations (I tested it on Linux).

yyy33 commented 1 year ago

I tried your configuration but, sorry I did not notice anything baffling. B is being repeated as long as only CapsLock and AltLeft are hold. Then, when I press H it keeps repeating A. I did not even notice a difference between your two configurations (I tested it on Linux).

Hi, can you test it again, sorry, my configuration file is wrong, the configuration file for the first step should be

CapsLock{H} >> A
(CapsLock AltLeft){H} >> B

The configuration file for step 4 should be

(CapsLock AltLeft){H} >> B
CapsLock{H} >> A
houmain commented 1 year ago

Hi, I tried your configuration. Now I can see what you mean. But this is intended behavior. First the AltLeft prevents the first mapping from applying. But once the AltLeft matched in the second mapping, it becomes optional.

Consider the following example. Pressing Meta{A{B}} with this configuration:

Meta{A} >> R
Meta{B} >> S

would output R and S instead of R and B. So the A between Meta and B is also ignored, since it already matched once.

Instead of switching the order of your mappings you could also write:

!AltLeft CapsLock{H} >> A
(CapsLock AltLeft){H} >> B
yyy33 commented 1 year ago

Hi, I tried your configuration. Now I can see what you mean. But this is intended behavior. First the AltLeft prevents the first mapping from applying. But once the AltLeft matched in the second mapping, it becomes optional.

Consider the following example. Pressing Meta{A{B}} with this configuration:

Meta{A} >> R
Meta{B} >> S

would output R and S instead of R and B. So the A between Meta and B is also ignored, since it already matched once.

Instead of switching the order of your mappings you could also write:

!AltLeft CapsLock{H} >> A
(CapsLock AltLeft){H} >> B

Thanks for the reply, I didn't understand it, but I think I need to read the keymapper code to understand it, but at least I know it's not a bug, thanks