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: single config will conflict with other combinations #465

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

cangSDARM
Copy link
Contributor

@cangSDARM cangSDARM commented Dec 12, 2023

抱歉,之前没有仔细查看源码,写的有问题。没有注意到_handlers是per key的

导致一种情况:

    hotkeys('ctrl+s', { single: true }, (e) => {
      expect(e.keyCode).toBe(83);
      expect(e.ctrlKey).toBeTruthy();
    });
    hotkeys('ctrl+shift+s', { single: true }, (e) => {
      expect(e.shiftKey).toBeTruthy();
      expect(e.keyCode).toBe(83);
      expect(e.ctrlKey).toBeTruthy();
    });

ctrl+s不会触发,只会触发后绑定的ctrl+shift+s (因为s重复。ctrl是特殊键不算重复)

这次修复了这个问题 (不会重置 _handlers,而是内部调用 unbind),顺便加了对应的test

@jaywcjlove jaywcjlove merged commit 964d66f into jaywcjlove:master Dec 12, 2023
jaywcjlove added a commit that referenced this pull request Dec 12, 2023
@jaywcjlove
Copy link
Owner

@cangSDARM Upgrade v3.13.2

github-actions bot pushed a commit that referenced this pull request Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants