diff options
| author | Adam Greenhall <agreenhall@lyft.com> | 2015-09-12 01:52:01 -0700 |
|---|---|---|
| committer | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-06 06:31:35 -0700 |
| commit | 74faef72d8e136a37bec93cc688817c97d162482 (patch) | |
| tree | b2cd48e9ff194d5b7d2b74e52a22e3e2021e8d97 /sqlparse | |
| parent | b15c9c60e2479f6397b7bbcb0787ee66c499e7f8 (diff) | |
| download | sqlparse-74faef72d8e136a37bec93cc688817c97d162482.tar.gz | |
Fix Case statements Alignment
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/filters.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sqlparse/filters.py b/sqlparse/filters.py index 2ce17e9..193029f 100644 --- a/sqlparse/filters.py +++ b/sqlparse/filters.py @@ -410,7 +410,7 @@ class AlignedIndentFilter: end_token = tlist.token_next_match(0, T.Keyword, 'END') cases.append((None, [end_token])) - condition_width = max(len(str(cond)) for cond, value in cases) + condition_width = max(len(' '.join(map(str, cond))) for cond, value in cases if cond) for i, (cond, value) in enumerate(cases): if cond is None: # else or end stmt = value[0] @@ -421,7 +421,7 @@ class AlignedIndentFilter: if i > 0: tlist.insert_before(stmt, self.whitespace(base_offset + case_offset - len(str(stmt)))) if cond: - tlist.insert_after(cond[-1], self.whitespace(condition_width - len(str(cond)))) + tlist.insert_after(cond[-1], self.whitespace(condition_width - len(' '.join(map(str, cond))))) if i < len(cases) - 1: # if not the END add a newline |
