Skip to content

Commit 63b74ea

Browse files
committed
Fix for FORD compatibility without whitespace formatting
1 parent 5504100 commit 63b74ea

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

fprettify/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ def reformat_ffile(infile, outfile, impose_indent=True, indent_size=3, strict_in
10861086
manual_lines_indent = []
10871087

10881088
lines, pre_ampersand, ampersand_sep = remove_pre_ampersands(
1089-
lines, orig_filename, stream.line_nr)
1089+
lines, is_special, orig_filename, stream.line_nr)
10901090

10911091
linebreak_pos = get_linebreak_pos(lines)
10921092

@@ -1304,7 +1304,7 @@ def get_linebreak_pos(lines):
13041304
return linebreak_pos
13051305

13061306

1307-
def remove_pre_ampersands(lines, filename, line_nr):
1307+
def remove_pre_ampersands(lines, is_special, filename, line_nr):
13081308
"""
13091309
remove and return preceding ampersands ('pre_ampersand'). Also return
13101310
number of whitespace characters before ampersand of previous line
@@ -1339,8 +1339,7 @@ def remove_pre_ampersands(lines, filename, line_nr):
13391339
# use default 1 whitespace character before ampersand
13401340
ampersand_sep.append(1)
13411341

1342-
lines = [l.strip(' ').strip('&') for l in lines]
1343-
1342+
lines = [l.strip(' ').strip('&') if not s else l for l, s in zip(lines, is_special)]
13441343
return [lines, pre_ampersand, ampersand_sep]
13451344

13461345

0 commit comments

Comments
 (0)