diff --git a/ahk/keys.py b/ahk/keys.py index 6eb0c85..7434947 100644 --- a/ahk/keys.py +++ b/ahk/keys.py @@ -23,11 +23,19 @@ def name(self) -> str: @property def DOWN(self) -> str: - return '{' + f'{self.name} down' + '}' + nameLen = len(self.name) + if '{' == self.name[0] and nameLen > 1: # don't add extra curly brackets if already braced + return f'{self.name[0:nameLen-1]} down' + '}' + else: + return '{' + f'{self.name} down' + '}' @property def UP(self) -> str: - return '{' + f'{self.name} up' + '}' + nameLen = len(self.name) + if '{' == self.name[0] and nameLen > 1: # don't add extra curly brackets if already braced + return f'{self.name[0:nameLen-1]} up' + '}' + else: + return '{' + f'{self.name} up' + '}' def __str__(self) -> str: return '{' + self.name + '}'