This required a couple of yaks to be shaved:1. MatchingOpeningBlockLineIndex was misused to also store the closing index; instead, use a second variable, as this doesn't work correctly for } else {.
- We needed to change the API of AffectedRangeManager to not use iterators; we always passed in begin / end for the whole container before, so there was no mismatch in generality.
- We need an extra check to discontinue formatting at the top level, as we now sometimes change the indent of the closing brace, but want to bail out immediately afterwards, for example:
void f() { if (a) { } void g();
Previously:
void f() { if (a) { } void g();
Now:
void f() { if (a) { } void g();
Format closing braces.
nit: replace -1 with UnwrappedLine::kInvalidIndex