diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2009-05-05 06:48:11 +0200 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2009-05-05 06:48:11 +0200 |
| commit | c8c23529249f4554f61b79121e78ff5192dc3bbe (patch) | |
| tree | 2c801fe3566e2b074e7b5a4ea8aaaa2c2ce0af0b /sqlparse | |
| parent | e9d921676a44b93d7d92978f8008cfdd9c5ca8b9 (diff) | |
| download | sqlparse-c8c23529249f4554f61b79121e78ff5192dc3bbe.tar.gz | |
Improved check for duplicated newlines (targets issue3).
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/filters.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sqlparse/filters.py b/sqlparse/filters.py index 91258ff..f1163ca 100644 --- a/sqlparse/filters.py +++ b/sqlparse/filters.py @@ -4,6 +4,7 @@ import re from sqlparse.engine import grouping from sqlparse import tokens as T +from sqlparse import sql class Filter(object): @@ -171,8 +172,10 @@ class ReindentFilter(Filter): if prev and prev.is_whitespace(): tlist.tokens.pop(tlist.token_index(prev)) offset += 1 - if prev and (str(prev).endswith('\n') - or str(prev).endswith('\r')): + if (prev + and isinstance(prev, sql.Comment) + and (str(prev).endswith('\n') + or str(prev).endswith('\r'))): nl = tlist.token_next(token) else: nl = self.nl() |
