Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions sqlparse/filters/aligned_indent.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class AlignedIndentFilter:
'UNION', 'VALUES',
'SET', 'BETWEEN', 'EXCEPT')

def __init__(self, char=' ', n='\n'):
def __init__(self, char=' ', n='\n', width=2):
self.n = n
self.width = width
self.offset = 0
self.indent = 0
self.char = char
Expand All @@ -32,7 +33,7 @@ def nl(self, offset=1):
# offset = 1 represent a single space after SELECT
offset = -len(offset) if not isinstance(offset, int) else offset
# add two for the space and parenthesis
indent = self.indent * (2 + self._max_kwd_len)
indent = self.indent * self.width

return sql.Token(T.Whitespace, self.n + self.char * (
self._max_kwd_len + offset + indent + self.offset))
Expand Down
2 changes: 1 addition & 1 deletion sqlparse/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def build_filter_stack(stack, options):
if options.get('reindent_aligned', False):
stack.enable_grouping()
stack.stmtprocess.append(
filters.AlignedIndentFilter(char=options['indent_char']))
filters.AlignedIndentFilter(width=options['indent_width'],char=options['indent_char']))

if options.get('right_margin'):
stack.enable_grouping()
Expand Down