Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding a curly bracket ("{}") check for the Key class #263

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions ahk/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -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' + '}'
hiroshi-ya marked this conversation as resolved.
Show resolved Hide resolved

@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' + '}'
hiroshi-ya marked this conversation as resolved.
Show resolved Hide resolved

def __str__(self) -> str:
return '{' + self.name + '}'
Expand Down
Loading