You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When split_reformatted_line splits lines, the incorrect indices are used when --enable-replacement has been applied, changing the number of characters in the line. The replacements are imposed by replace_relational_single_fline(f_line,... after get_linebreak_pos(lines,... has been called, so when format_single_fline is called in the impose_whitespace block, the line gets sliced in the wrong place(s).
The .AND. does not get split if I disable replacement, or if I replace the == with .EQ. myself (therefore making the number of characters in the line not change after replacement).
Update: I can work my way around this with the following change to __init__.py, though I have not extensively tested it:
@@ -1561,16 +1561,17 @@ def reformat_ffile_combined(infile, outfile, impose_indent=True, indent_size=3,
lines, pre_ampersand, ampersand_sep = remove_pre_ampersands(
lines, is_special, orig_filename, stream.line_nr)
- linebreak_pos = get_linebreak_pos(lines, filter_fypp=not indent_fypp)
-
f_line = f_line.strip(' ')
if impose_replacements:
f_line = replace_relational_single_fline(f_line, cstyle)
+ lines = [replace_relational_single_fline(l, cstyle) for l in lines]
if impose_case:
f_line = replace_keywords_single_fline(f_line, case_dict)
+ linebreak_pos = get_linebreak_pos(lines, filter_fypp=not indent_fypp)
+
if impose_whitespace:
The text was updated successfully, but these errors were encountered:
I think that's similar to #153. And your change appears to be much shorter than my proposed solution, so I'd vote for that. I'd hope my proposed changed test still makes sense.
Do you have a PR set up for your solution yet? If not, I can put one in, and then if you're willing to help contribute testing to that, that'd be great.
#154 is my uglier fix. The test is pretty basic, I've simply adjusted the existing one to catch this case as well I believe. But I've also seen in #127 that the tests are going to be changed?
When
split_reformatted_line
splits lines, the incorrect indices are used when--enable-replacement
has been applied, changing the number of characters in the line. The replacements are imposed byreplace_relational_single_fline(f_line,...
afterget_linebreak_pos(lines,...
has been called, so whenformat_single_fline
is called in theimpose_whitespace
block, the line gets sliced in the wrong place(s).Example:
The
.AND.
does not get split if I disable replacement, or if I replace the==
with.EQ.
myself (therefore making the number of characters in the line not change after replacement).Update: I can work my way around this with the following change to __init__.py, though I have not extensively tested it:
The text was updated successfully, but these errors were encountered: