diff --git a/sqlparse/filters.py b/sqlparse/filters.py index 86624a89..68e9b1ab 100644 --- a/sqlparse/filters.py +++ b/sqlparse/filters.py @@ -236,13 +236,15 @@ def _stripws(self, tlist): def _stripws_default(self, tlist): last_was_ws = False + is_first_char = True for token in tlist.tokens: if token.is_whitespace(): - if last_was_ws: + if last_was_ws or is_first_char: token.value = '' else: token.value = ' ' last_was_ws = token.is_whitespace() + is_first_char = False def _stripws_identifierlist(self, tlist): # Removes newlines before commas, see issue140