dawnbeen / c_formatter_42

C language formatter for 42 norminette
GNU General Public License v3.0
176 stars 17 forks source link

Does not break lines over 80 characters in assignment or comparison when having pointer casts and arrow notation #74

Open bcheronn opened 11 months ago

bcheronn commented 11 months ago

Version

pip list
Package                Version
---------------------- ------------------------------------
...
c-formatter-42         0.2.7

The following code is properly formatted:

void    ft_example(void)
{
    t_list  *element;
    t_list  *next_element;

    ((t_node *)element->content)->index
        += ((t_node *)next_element->content)->index;
    if (((t_node *)element->content)->index
        && ((t_node *)next_element->content)->index)
        exec_logic(element);
}

whereas this one is not (the only difference being the operators used in the assignment and the comparison:

void    ft_example(void)
{
    t_list  *element;
    t_list  *next_element;

    ((t_node *)element->content)->index = ((t_node *)next_element->content)->index;
    if (((t_node *)element->content)->index > ((t_node *)next_element->content)->index)
        exec_logic(element);
}

Tested using the formatter only, without any extension