Discussion:
[Qt-creator] C++ Code Style and empty lines
Benjamin TERRIER
2018-02-15 10:59:25 UTC
Permalink
Hello,

Is there a way in Qt Creator to set the C++ code style so that there
are no indentation spaces in empty lines?

I'm looking for this, because last time I made a contribution to Qt I tried to
auto indent some code and it added spaces in empty lines. This is undesirable
because it goes against Qt Project code style.

Also, this conflicts with the behavior of "Cleanups Upon Saving" options.
Because if "Clean whitespace" is checked, it will remove the "space on
empty line" added by the auto-indent function.
The "clean indentation" option seems to have no effects on this, which
is kind of weird, because that means that "auto-indent" and "clean
indentation" do not agree on what the indentation should look like in
empty lines.

Regards,

Benjamin
Dmitry Volosnykh
2018-02-15 11:03:01 UTC
Permalink
This post might be inappropriate. Click to display it.
Benjamin TERRIER
2018-02-15 11:59:39 UTC
Permalink
Post by Dmitry Volosnykh
Hi, Benjamin
Tools menu / Options menu item / Text Editor entry in the list on the left /
Behaviour tab / Cleanups Upon Saving control group
I know about this, I even talk about this in my email.

My concern is about the auto indent function (Right Click >
Auto-indent Selection)
Nikos Chantziaras
2018-02-15 18:35:57 UTC
Permalink
Post by Benjamin TERRIER
Post by Dmitry Volosnykh
Hi, Benjamin
Tools menu / Options menu item / Text Editor entry in the list on the left /
Behaviour tab / Cleanups Upon Saving control group
I know about this, I even talk about this in my email.
My concern is about the auto indent function (Right Click >
Auto-indent Selection)
If you don't save the file after auto-indenting it, then how did you end
up with spaces in empty lines unless you didn't enable cleanup-on-save?
Benjamin TERRIER
2018-02-15 22:20:36 UTC
Permalink
Post by Benjamin TERRIER
Post by Dmitry Volosnykh
Hi, Benjamin
Tools menu / Options menu item / Text Editor entry in the list on the left /
Behaviour tab / Cleanups Upon Saving control group
I know about this, I even talk about this in my email.
My concern is about the auto indent function (Right Click >
Auto-indent Selection)
If you don't save the file after auto-indenting it, then how did you end up
with spaces in empty lines unless you didn't enable cleanup-on-save?
Again, I am not asking about the "cleanup on save" feature.
And I never said I ended up with spaces on empty lines *after* saving the file.

I am asking if there is a way to configure the auto-indent feature so
that it does not
generate extra spaces on empty lines.

The fact that the "cleanup on save" feature, when enabled (with or
without the clean indent option
checked), needs to clean up what the auto indent feature just did,
just proves that as-is
the auto-indent feature is bugged (if not configurable).

I do not expect the auto-indent feature to add whitespaces that need
to be cleaned.
I would rather expect the "cleanup on save" and auto indent features to produce,
or at least try to produce, the same result.
Eike Ziller
2018-02-16 08:18:58 UTC
Permalink
Post by Benjamin TERRIER
Post by Benjamin TERRIER
Post by Dmitry Volosnykh
Hi, Benjamin
Tools menu / Options menu item / Text Editor entry in the list on the left /
Behaviour tab / Cleanups Upon Saving control group
I know about this, I even talk about this in my email.
My concern is about the auto indent function (Right Click >
Auto-indent Selection)
If you don't save the file after auto-indenting it, then how did you end up
with spaces in empty lines unless you didn't enable cleanup-on-save?
Again, I am not asking about the "cleanup on save" feature.
And I never said I ended up with spaces on empty lines *after* saving the file.
I am asking if there is a way to configure the auto-indent feature so
that it does not
generate extra spaces on empty lines.
It should definitely not add extra spaces on empty lines. That sounds very much like a bug to me. Probably one that no one found because of the clean-on-save feature, but still.
Please --> https://bugreports.qt.io

Br, Eike
Post by Benjamin TERRIER
The fact that the "cleanup on save" feature, when enabled (with or
without the clean indent option
checked), needs to clean up what the auto indent feature just did,
just proves that as-is
the auto-indent feature is bugged (if not configurable).
I do not expect the auto-indent feature to add whitespaces that need
to be cleaned.
I would rather expect the "cleanup on save" and auto indent features to produce,
or at least try to produce, the same result.
_______________________________________________
Qt-creator mailing list
http://lists.qt-project.org/mailman/listinfo/qt-creator
--
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
***@qt.io
http://qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
Benjamin TERRIER
2018-02-16 10:46:09 UTC
Permalink
Post by Eike Ziller
It should definitely not add extra spaces on empty lines. That sounds very much like a bug to me. Probably one that no one found because of the clean-on-save feature, but still.
Please --> https://bugreports.qt.io
Br, Eike
Done: https://bugreports.qt.io/browse/QTCREATORBUG-19828

Regards,

Benjamin

Loading...