stylus icon indicating copy to clipboard operation
stylus copied to clipboard

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

Open dnknn opened this issue 2 years ago • 3 comments

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;

dnknn avatar Jul 16 '23 13:07 dnknn

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.

tophf avatar Jul 16 '23 19:07 tophf

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

dnknn avatar Jul 19 '23 16:07 dnknn

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

tophf avatar Jul 19 '23 17:07 tophf