diff --git a/cmds/add.py b/cmds/add.py index 6a57f8642e1..8421510d35a 100644 --- a/cmds/add.py +++ b/cmds/add.py @@ -20,9 +20,6 @@ def exec(message: Message): size = len(row) - len(row.lstrip()) spaces.append(size) - # Subtracting the min prepending space off of each line so the board shape is defined from the relative shape of the input and you can have prepending spaces. - spaces = [row - min(spaces) for row in spaces] - # Determine board type with leading whitespace if spaces[0] < spaces[1] < spaces[2]: board = 'stagger' diff --git a/cmds/setfingermap.py b/cmds/setfingermap.py index f60f6d6df7d..dbe21cc4426 100644 --- a/cmds/setfingermap.py +++ b/cmds/setfingermap.py @@ -75,8 +75,6 @@ def board_value(rows): size = len(row) - len(row.lstrip()) spaces.append(size) - spaces = [row - min(spaces) for row in spaces] - # Determine board type with leading whitespace if spaces[0] < spaces[1] < spaces[2]: return 'stagger' diff --git a/util/parser.py b/util/parser.py index c351e7bbcfa..8f5657ef048 100644 --- a/util/parser.py +++ b/util/parser.py @@ -19,7 +19,9 @@ def get_layout(message: Message) -> Tuple[str, str]: args = tokens[0].split() name = '-'.join(args[2:] if args[0] in TRIGGERS else args[1:]).lower() - matrix = tokens[1].strip().lower() + lines = [line for line in tokens[1].splitlines() if line.strip() != ''] + min_space = min(len(line) - len(line.lstrip()) for line in lines) + matrix = '\n'.join([line[min_space:] for line in lines]) return name, matrix