Page 1 of 1

Key name synonyms

Posted: 26 Oct 2019, 20:02
by lexikos
Currently there are some keys that have multiple names, with no difference in VK or SC:
Escape/Esc
Backspace/BS
Enter/Return
Delete/Del
Insert/Ins
Pause/Break (but CtrlBreak is a separate VK)
LControl/LCtrl
RControl/RCtrl
Control/Ctrl

It seems preferable to remove Return and Break due to the ambiguity with control flow statements. (I might be biased, as I've always known them as Enter and Pause.)

Because hotkeys are identified by name, Del:: and Delete:: are two different hotkeys, and are not detected as duplicates. This sometimes causes issues with context-sensitive hotkeys; for example, Problems with key name synonyms (Ex: Delete and Del). On the other hand, it might be better to identify these hotkeys by key code instead - e.g. treat Backspace, BS and vk08 as the same. A side-effect would be that A_ThisHotkey would return whichever name was used first (it already "locks in" the exact string of modifier symbols).

Having multiple names also increases the risk of confusion for functions that return key names, such as GetKeyName, Input and InputHook.EndKey. For example, and end key can be passed as "Del" but return "Delete" (this is documented; also, vk2E does the same).

The longer names are sometimes better for clarity, but the shorter names are more convenient (e.g. for {BS 3}by the way). Hotstrings or auto-replace within the editor can compensate for loss of convenience if the shorter names are removed, but the shorter names are also generally better if the key name is included multiple times in a string.

FWIW, the Microsoft Style Guide includes a section about keys. They recommend "Backspace", "Ctrl", "Del", "Enter", "Esc" and "Insert". Sentence case is used for names with multiple words, but that doesn't matter since we don't use spaces.

Spoiler

Re: Key name synonyms

Posted: 27 Oct 2019, 07:45
by jeeswg
If I had to pick one:
Escape/Esc [Esc]
Backspace/BS [Backspace][I haven't minded using the longer form with Send]
Enter/Return [Enter]
Delete/Del [Del][consistent with NumpadDel]
Insert/Ins [Ins][consistent with NumpadIns]
Pause/Break [Pause]
LControl/LCtrl [LCtrl]
RControl/RCtrl [RCtrl]
Control/Ctrl [Ctrl]