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

[ClangFormat] Incorrect indentation on pasting code

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • Qt Creator 13.0.0
    • Kubuntu 22.04
    • Linux/X11

    Description

      When ClangFormat is enabled, pasted code is incorrectly indented in some instances.

      Steps to reproduce:

      1. Unpack the attached project.
      2. In the unpacked project directory, backup main.cpp by copying it to e.g. main.cpp-orig.
      3. Open and configure the project in QtCreator (Boost needs to be installed on the system).
      4. Open main.cpp in the editor.
      5. Select all (Ctrl+A), cut (Shift+Del) and paste (Shift+Ins).
      6. Save the modified main.cpp and compare it with the original main.cpp-orig.

      You will notice that the resulting formatting is broken in some instances:

      • The list of base classes for my_object and group_iterator are indented to the right, past the colon on the previous line.
      • Some comments are indented deeper than before.
      • Closing angle brackets in multi-line typedefs and base classes are indented deeper than before.
      • Where indentation is modified, it sometimes contain spaces rather than tabs (i.e. the editor attempts to emulate "half-tabs").

      Expected behavior:

      The pasted code should look exactly like in the original.

      Attachments

        Issue Links

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

          Activity

            People

              hjk hjk
              lastique Andrey Semashev
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes