Skip to content

Larger "small" heuristics for smaller max_width #2606

@kaj

Description

@kaj

I'm not sure where to put this. It is kind of related to #2299, #2447, and #2437. But I might be happier with a simpler solution than whats suggested there, so I open a specific issue.

I use max_width = 78 (since I want a git diff of my code to fit within an 80 chars wide terminal), and I want "short" struct literals and if-else statements to be single line, so I leave use_small_heuristics to its default true value.

Since most of the the default WidthHeuristics are defined in relation to max_width, which defaults to 100, I think many of the heuristics simply get too small when using a smaller max_width.

So my intent was to suggest non-linear values in WidthHeuristics::scale (maybe simply leaving it as is for max_width >= 90 and otherwise using e.g. values 85, 25, 50, and 75 instead of 60, 18, 35, and 50).

But maybe something like #2447 is a better alternative? Maybe it can be generalized to having different named set of heuristics? On the other hand, less configuration is better, so I rather like the concept that the heuristics should attempt to adapt as good as possible to the given max_width.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions