Closed lgrandco closed 1 year ago
Encountered the bug recently too and have just pushed a fix to my fork. Will soon open a PR here
(please don't send code as screenshot 😢 , just the the triple back quote)
This is probably made by the line_breaker
formatter of @keyhr.
This is caused by some weird Norminette exception that variable assignments have one additional indent when nesting occurs. Don't ask me the reasoning behind this.....
sorry for the screenshot, I just saw this issue https://github.com/dawnbeen/c_formatter_42/issues/50, so it seems that both assigning and calling a function add an indent level, that's why it needed one more here
so
ft_fprintf(2, "\r%d/%d %ld %ld", i + 1, g->w.y, (t_u64)m,
(t_u64)g->b.z);
and
z = (t_v2d){g->b.rs + ((t_f64)j / g->w.x) * (g->b.re - g->b.rs),
g->b.is + ((t_f64)i / g->w.y) * (g->b.ie - g->b.is)};
are now correctly formated, but
z = ft_fprintf(2, "\r%d/%d %ld %ld", i + 1, g->w.y, (t_u64)m,
(t_u64)g->b.z);;
should be
z = ft_fprintf(2, "\r%d/%d %ld %ld", i + 1, g->w.y, (t_u64)m,
(t_u64)g->b.z);;
@lgrandco can you clone the branch from #63 and test it on your local machine to make sure this is actually fixed?
it fixed
z = ft_fprintf(2, "\r%d/%d %ld %ld", i + 1, g->w.y, (t_u64)m,
(t_u64)g->b.z);;
(correct)
but does not work for
t_z.z = ft_fprintf(2, "\r%d/%d %ld %ld", i + 1, g->w.y, (t_u64)m,
(t_u64)g->b.z);;
(same with)
t_z->z
Ah I see. The problem is it only matches {name} = ...
but the regex doesn't match dot notation or arrow notation. No idea if there's even such a regex helper for that in the code already?
I mean perhaps I could change it to ... = ...
(basically any line with an equal sign) but not sure if it's a good idea 🤔
Alright fixed now with a tweaked regex r"^\s*({decl})((\.|->){decl})*\s+=\s+[^;]*?;$"
everything seems good, thanks 👍
when we continue the previous line on a new line, we need to indent twice instead of once, but it re formats to only one tab so we need to save without formatting. wrong (just formatted): correct: