Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-4310

alignment unintuitive for expressions split on multiple lines

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • Qt Creator 2.3.0
    • Qt Creator 2.3.0
    • C/C++/Obj-C++ Support
    • None
    • Linux 64bit
      Windows Vista
    • 779fafcbfe6f92dd1288664fae512f69bc12418b

    Description

      Alignment of multi-line expressions is done using automatic indentation with 4 spaces. It does not respect user's indentation or, better, the expected behavior described later below. Right now, one obtains:

      some_expression = a +
          b -
          c;
      

      Based on general (feeling) rules of indentation in the C++ editor, I would expect alignment of many items of an expression to be done to the column of the first item, when splitting an expression on multiple lines. Like in:

      some_expression = a +
                        b -
                        c;
      

      or, depending where the user places the signs:

      some_expression = a
                      + b 
                      - c;
      

      Parenthesized expressions are treated correctly right now:

      some_expression = (a +
                         b -
                         c);
      

      So do expressions containing pipe operators:

      some_stream << a
                  << b;
      

      I understand that this could be a question of taste, but I believe that the way I would like it is also the way of least surprise. At a minimum, user's indentation setting should be respected.

      Thank you very much for the attention.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              ckamm Christian Kamm
              tibirna Cristian Tibirna
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes