GetUnicodeName: One name per line
GetUnicodeName() uses "AND" to join the names.
It's not clear visually.
Suggestion:
One name per line.
(Or, use [] or something.)
You can iterate through the characters of the string to get the name for each character. The attached script demonstrates how to iterate through characters in ascii strings and Unicode strings.
var string = 'ab';
// For ascii string
for (var i = 0; i < string.length; i++) {
alert(editor.GetUnicodeName(string.charAt(i)));
}
// For unicode
var tmp = '';
for (var i = 0; i < string.length; i++) {
tmp += string.charAt(i);
if (!(0xd800 <= string.charCodeAt(i) && string.charCodeAt(i) <= 0xdbff)) {
alert(editor.GetUnicodeName(tmp));
tmp = '';
}
}
Yes it can be done char by char.
But since GetUnicodeName() supports a string, how about directly making the default result clearer to encourage users to use it?
And, for example, if I choose to split the default result in a macro, it's not proper to use " AND " as the separator, because a Unicode name could contain " AND ".
It's a pity if we have to avoid using the default result for a string.
---------------
By the way,
I have a memory that "Character Code Value" command used to be able to handle the 1st character of a string selection.
But now it can't.
Is this a change or a bug?
The next version will use a semicolon instead of AND as the separator.
As for your second question, it was confusing in old versions of EmEditor when multiple characters were selected. Newer versions clarified the behavior by NOT showing character codes or unicode names if multiple characters are selected.
4 posts in this topic