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

快捷键识别不正确 #5949

Closed
1 task done
iamqiz opened this issue Sep 25, 2022 · 3 comments
Closed
1 task done

快捷键识别不正确 #5949

iamqiz opened this issue Sep 25, 2022 · 3 comments
Assignees
Labels
Milestone

Comments

@iamqiz
Copy link
Contributor

iamqiz commented Sep 25, 2022

该问题是否已经被报告过了? Is there an existing issue for this?

  • 我已经搜索了 Issues,没有发现类似问题
    I have searched the existing issues

描述问题 Describe the problem

_getKeymapString 这个函数
无法正确识别以下快捷键
shift+alt+\
shift+alt+;
shift+alt+'
shift+alt+,
shift+alt+/
原因在于 下面344/351-352行,

} else if (event.altKey) {
const codeKey = event.code.substr(event.code.length - 1, 1).toUpperCase();
if (event.key === "Enter") {
keymapStr += "↩";
} else if (event.key.startsWith("F") && event.key.length > 1) {
keymapStr += event.key;
} else if (event.code === "Period") {
keymapStr += ".";
} else if (codeKey !== "I" && codeKey !== "E" && codeKey !== "N" && codeKey !== "U") {
keymapStr += codeKey;
} else if (event.which === 229) {
setTimeout(() => {
it.value = "";
});
}
} else if (event.key === "》") {

\;',/ 这5个键的code分别为:
Backslash/Semicolon/Quote/Comma/Slash
因此codeKey 分别取H/N/E/A/H, 导致351-352行不正确

  • 还有个疑问:
    为什么L343-L357 行的alt键要单独处理?
    351行 (codeKey !== "I" && codeKey !== "E" && codeKey !== "N" && codeKey !== "U") 这个为什么不处理呢?

期待的结果 Expected result

1

截屏或者录屏演示 Screenshot or screen recording presentation

No response

版本环境 Version environment

- Version: 
- Operating System: 
- Browser (if used):
     1

日志文件 Log file

1

更多信息 More information

No response

@88250 88250 added the Bug label Sep 25, 2022
@88250 88250 added this to the 2.2.1 milestone Sep 25, 2022
@88250 88250 closed this as completed Sep 25, 2022
Vanessa219 added a commit that referenced this issue Sep 25, 2022
@iamqiz
Copy link
Contributor Author

iamqiz commented Sep 25, 2022

@Vanessa219 V姐厉害!
提个建议,不如把所有特殊符号_+{}|这些都变成小写?
一是因为其他编辑器基本都是小写形式,
二是使用大写形式,则ctrl + shift + =会变成下图
Snipaste_2022-09-25_13-27-57

@Vanessa219
Copy link
Member

这个我也没太弄明白,在 IDE 里面,有些组合使用的是大写,有些组合使用的小写,而且这些判断在组合键不同的时候还不一样。所以这里我就统一使用了有 shift 的输出。

@iamqiz
Copy link
Contributor Author

iamqiz commented Sep 25, 2022

@Vanessa219 同一个IDE里面还会混用大小写形式的特殊符号吗? jetbrains和vscode里是小写的,
在有shift键的时候再大写,感觉多此一举了
另外大写还有个缺点:
在快捷键搜索时, 输入 / 期望搜索出ctrl+shift+/ 这样的快捷键, 但因为它的keymapStr是⌘⇧? 里面没有/ 所以搜不出来

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants