@@ -61,25 +61,25 @@ static const KeycodeNames _keycode_to_na
/**
* Try to parse a single part of a keycode.
* @param start Start of the string to parse.
* @param end End of the string to parse.
* @return A keycode if a match is found or 0.
*/
static uint16 ParseCode(const char *start, const char *end)
{
assert(start <= end);
while (start < end && *start == ' ') start++;
while (end > start && *end == ' ') end--;
for (uint i = 0; i < lengthof(_keycode_to_name); i++) {
if (strncasecmp(start, _keycode_to_name[i].name, end - start) == 0) {
if (strlen(_keycode_to_name[i].name) == end - start && strncasecmp(start, _keycode_to_name[i].name, end - start) == 0) {
return _keycode_to_name[i].keycode;
}
if (end - start == 1) {
if (*start >= 'a' && *start <= 'z') return *start - ('a' - 'A');
return *start;
return 0;
* Parse a string representation of a keycode.