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

[editor] Double-clicking selects can also support non-English tokens ? #1630

Open
dnknn opened this issue Jul 16, 2023 · 3 comments
Open

[editor] Double-clicking selects can also support non-English tokens ? #1630

dnknn opened this issue Jul 16, 2023 · 3 comments

Comments

@dnknn
Copy link

dnknn commented Jul 16, 2023

Of course, this is not a big problem...

Normal behavior of \w+(ANSI characterSet) tokens

.aa#cc.bb[ee]	{--radius:9px;	padding:var(--radius, 5px);	animation:abcde 1s linear;}

Double-clicking selects the tokens of .aa #cc ee --radius abcde, are perfectly correct!


Abnormal behavior of contains non-ANSI characterSet tokens

.测试.bb, .a测试a.bb, .aa#测试.bb[看看]	{
	--半径:9px;		padding:var(--半径, 5px);
	animation:_3分1透明到零2 1s;		animation:转圈圈 1s;
}
@keyframes _3分1透明到零2	{33%{opacity:1} to{opacity:0}}

Double-clicking selects the tokens of .测试 .a测试a #测试 看看 --半径 转圈圈, would not behave as expected.

Screenshot

image

xx	{	--半径 : 9px;	padding:var( --半径 , 5px);	animation: 转圈圈 1s;}

Only when there are blank-spaces(\s) before and after the tokens can they be correctly selected.


animation:_3分1透明到abc零2 1s;
@tophf
Copy link
Member

tophf commented Jul 16, 2023

To fix this we would need to replace all \w everywhere with \p{L} which is only supported since Chrome 64 and Firefox 78. We can do it once we migrate to ManifestV3.

@dnknn
Copy link
Author

dnknn commented Jul 19, 2023

To fix this we would need to replace all \w everywhere with \p{L} ..... once we migrate to ManifestV3.

Thanks! At the same time, new regular knowledge was learned!
A tip:  \p{L}\w,  \p{L} does not contain _ and \d
online test: regex101.com/r/5zw6fF/latest

@tophf
Copy link
Member

tophf commented Jul 19, 2023

Yeah, so I guess we'd use something like [-_\\\p{L}\d]

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

No branches or pull requests

2 participants