<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Ternary operators over multiple lines are always aligned, no option to treat them like regular continuation lines"
   href="https://bugs.llvm.org/show_bug.cgi?id=48736">48736</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Ternary operators over multiple lines are always aligned, no option to treat them like regular continuation lines
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Formatter
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>arnfranke@yahoo.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24375" name="attach_24375" title="Picture of absurd indentation when viewed on GitHub">attachment 24375</a> <a href="attachment.cgi?id=24375&action=edit" title="Picture of absurd indentation when viewed on GitHub">[details]</a></span>
Picture of absurd indentation when viewed on GitHub

For context, see <a href="https://github.com/godotengine/godot/pull/45136">https://github.com/godotengine/godot/pull/45136</a>

It's currently not possible to have ternary continuation lines use the normal
continuation behavior. Clang-format insists on aligning ternary continuation
lines such that both of the possible values are aligned. In some cases this
leads to absurd code formatting. In the snippet I pointed out on GitHub, the
code doesn't start until column 61 (or column 121 for anyone using 8-size tabs
or viewing on GitHub) and continues for 60 more characters (for anyone using
8-size tabs, this means that the code doesn't end until column 181).

I would like to instead use the normal continuation line behavior, with the
"ContinuationIndentWidth" setting, so that ternary continuation lines are
always a fixed amount of width from the start of the main line just as other
continuation lines already do. Perhaps there should be a setting called
something like "AlignTernaryOperators" with a default setting of true, and then
I could set this to false to get the desired behavior (in the linked snippet
this would mean the line starts at column 25, or 49 for 8-size tabs).</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>