gn: Check if formatting a single line list to multiple reduces penalty

Previously, when formatting binary operators, gn format would only try
to break around the operators, but the determination of whether a list
was single or multiline was only determined by the number of elements
in the list (and in some cases, the LHS of the assignment).

Instead now, check if spliting a single line list into multiline would
avoid going past 80 columns.

A test run of running this new behaviour on all of chromium/src is at
https://chromium-review.googlesource.com/c/chromium/src/+/801660/, and
it seems like a universal improvement, fixing a number of misformattings.

Bug: 790021
Change-Id: I06ab6f06388dc9429a75407864769484d3fcea41
Reviewed-on: https://chromium-review.googlesource.com/801658
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#520726}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7f86d891eda0a8a4207a7c65fd353702ff15c26c
4 files changed
tree: a3e66ed64458f660802acc927c6e3f6836f17fd6
  1. tools/