Can I completely disable line wrapping in QtCreator C++ editor?
-
I would like to configure the QtCreator C++ editor in such a way that all those indentation rules work (for example, if I set the "public:" inside a class to be indented, I want it to work) when I press Ctrl+;
but at the same time I want to lines to stay exactly the way I wrote them, plus any indentation fixes if I configured those fixes.I have a line which looks like this (should be a single long line):
When I press Ctrl+; to format the selected text (including that line above), I get this:
Is there a way to make sure that a line - however long it is - will NOT be broken into multiple lines?
Please advise.
I am kinda desperate already.
For the past several months, I have been paying for CLion simply because its formatting makes (or rather, keeps) my code readable. But CLion suddenly started doing pretty much the same nonsense, even though I did not even touch the settings or do any kind of resets. So, I don't even want it anymore. QtCreator has a far more superior debugger, AND it consumes far less memory and CPU. It's just this auto-wrapping problem is driving me nuts. Please help. -
It's not Qt Creator that wraps your line. When
CTRL+;
is pressed, the Clang formatter is invoked (in my case ClangFormat version 17.0.1.). That's an external formatter, which acts according to its specification. If you don't like it, don't use it. You can't bake an omelet without breaking eggs. -
-
@Axel-Spoerl
I am sorry, I do not understand what your screenshot means.
I checked, and my settings are precisely the same.
The only one which sounds like it could help, which is "Align continuation lines" --> "Not at all", did not change the wrapping.
No other settings seem to be related to the line-wrapping issue.My settings:
-
Maybe I misunderstood wrapping with indentation. Sorry about that.
Move to the "Display" tab, and disable line wrapping there. -
Maybe I misunderstood wrapping with indentation. Sorry about that.
Move to the "Display" tab, and disable line wrapping there.@Axel-Spoerl
The one setting I see there, "Enable text wrapping", was already unchecked.
Just in case, I checked it, tested, unchecked again and re-tested.
I did not affect the line wrapping. It's still the same. -
I think we are talking about different things.
The line wrapping forces a wrap, when you type over the maximum length of a line.
If I toggle it, it works as expected.It looks to me, that it does that also for you. It would be a serious bug, if it wouldn’t.
After re-reading your post, it is not about line wrapping as the title suggests. It’s about what the code formatter does with a long, unwrapped line.
Am I right?
So which code formatting settings do you use? -
I think we are talking about different things.
The line wrapping forces a wrap, when you type over the maximum length of a line.
If I toggle it, it works as expected.It looks to me, that it does that also for you. It would be a serious bug, if it wouldn’t.
After re-reading your post, it is not about line wrapping as the title suggests. It’s about what the code formatter does with a long, unwrapped line.
Am I right?
So which code formatting settings do you use?@Axel-Spoerl
On the "C++" -> "Code Style" -> "Clang Format Settings" -> "Formatting mode" dropdown, I tried all 3 settings, and I also tried changing a lot of settings when using "Use custom settings" and playing with lots of various options in the long list of "Clang format", based on either GNU (built-in) or Qt (built-in) standard settings.
Nothing that I tried seemed to keep my long lines unbreakable. -
It's not Qt Creator that wraps your line. When
CTRL+;
is pressed, the Clang formatter is invoked (in my case ClangFormat version 17.0.1.). That's an external formatter, which acts according to its specification. If you don't like it, don't use it. You can't bake an omelet without breaking eggs. -
@Axel-Spoerl
On the "C++" -> "Code Style" -> "Clang Format Settings" -> "Formatting mode" dropdown, I tried all 3 settings, and I also tried changing a lot of settings when using "Use custom settings" and playing with lots of various options in the long list of "Clang format", based on either GNU (built-in) or Qt (built-in) standard settings.
Nothing that I tried seemed to keep my long lines unbreakable.@fafnir
I don't use or know about this, but does one of the suggestions in, say, Can you set clang-format's line length? (from a few years ago) work for you to stop where it is line breaking?Reference material at https://clang.llvm.org/docs/ClangFormatStyleOptions.html. [Oh, Axel already referenced same.]
-
It's not Qt Creator that wraps your line. When
CTRL+;
is pressed, the Clang formatter is invoked (in my case ClangFormat version 17.0.1.). That's an external formatter, which acts according to its specification. If you don't like it, don't use it. You can't bake an omelet without breaking eggs.@Axel-Spoerl @JonB
Thank you very much for your help!I had ColumnLimit set to a very generous number, well above the lines' lengths that started wrapping all of a sudden a couple of days ago, but after I set it to an even greater number (300, to be exact), the line wrapping is working again as expected.
Thank you!
-
-