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

Saving a file sometimes removes indentation

    Details

    • Type: Bug
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: Qt Creator 4.0.0-rc1
    • Fix Version/s: None
    • Component/s: C/C++/Obj-C++ Support
    • Labels:
      None
    • Environment:
      Kubuntu 16.04, x86_64, KDE, CMake 3.5.1.

      Description

      I have a C++ CMake project consisting of multiple executables and libraries. Throughout the project, only .cpp files are listed in CMakeLists.txt as source files (header files are not listed). In some cases, when I save modified headers, QtCreator removes indentation of some parts of the header. E.g. typedefs like these get unindented:

      typedef boost::intrusive::slist_base_hook<
      	boost::intrusive::link_mode< boost::intrusive::safe_link >
      > filter_list_base_hook;
      
      typedef boost::intrusive::slist<
      	obj,
      	boost::intrusive::base_hook< obj_list_hook_t >,
      	boost::intrusive::linear< true >,
      	boost::intrusive::cache_last< true >,
      	boost::intrusive::constant_time_size< false >
      > obj_slist;
      

      Class members and code in methods in the same header does not get unindented though.

      I'm not sure what triggers this behavior as it happens on some headers and not others. I failed to reproduce it in a test project.

      I did notice that the behavior is triggered only when Text Editor -> Behavior tab -> Cleanups Upon Saving block -> Clean indentation option in QtCreator settings is enabled. I have Tab policy set to Tabs Only, and the headers in question do have tabs for indentation. Code style in the C++ section is also set to use tabs for indentation.

        Attachments

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

          Activity

            People

            • Assignee:
              kosjar Nikolai Kosjar
              Reporter:
              lastique Andrey Semashev
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes