<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/98559>98559</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
When breaking on ternary operators with AlignOperands set, continuation indent is also added
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kelnos
</td>
</tr>
</table>
<pre>
Config:
```yaml
Language: Cpp
BasedOnStyle: LLVM
AlignOperands: Align # default implied by LLVM style, but similar issue with AlignAfterOperator set instead
BreakBeforeTernaryOperators: true # default implied by LLVM style
ContinuationIndentWidth: 4 # default implied by LLVM style
# Not strictly necessary to repro, but makes it easy to repro without having long lines
ColumnLimit: 0
# Not necessary for repro, but illustrates that binary operator alignment is handled differently
BreakBeforeBinaryOperators: NonAssignment
```
The following code (as typed):
```c
int foo = bar > baz
? 42
: 99;
```
Gets reformatted to:
```c
int foo = bar > baz
? 42
: 99;
```
It looks like what's happening is that it's first aligning the `?` and `:` underneath the "b" in `bar` as per `AlignOperands`, but then it also adds four more spaces per `ContinuationIndentWidth`.
The four extra spaces are undesirable, and would seem to contradict the documentation. What I expect to see:
```c
int foo = bar > baz
? 42
: 99;
```
Setting `ContinuationIndent` to `0` "fixes" the problem, but of course gives undesirable formatting in all the other places where continuation indents are used.
Note that *binary* operators are handled how I would consider correctly (after formatting):
```c
int biff = foo
+ bar
+ baz;
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU1v4zYQ_TX0ZbCGQvkjPuhgJ3URIM0edtGcKXFksaE4AjmK4_31xUjWJtkkbYA2CGSQQw7fvDcfJiV3CIiFWu7U8npmem4oFg_oA6VZSfZUXFGo3UHlW5Vdq2z6rrLx_2RaP27dmnDozQFVvoWrrhs3dyah_Rq-8ckPhtvbP_8YLVvvDuFrh9EEm8Q0bAAonYPF2vSewbWdd2ihPA0XIQ1u9BWUPUNyrfMm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