When I use the IDE 2.3.7 Autoformat tool on a sketch containing lines over 80 chars in length it gives the unwanted result of splitting it into two lines.
These two examples get split:
#define button 2 // this is 81 chars long this is 81 chars longxxxxxxxxxxxxx12345
const int xyz = 0; // this is 81 chars long this is 81 chars longxxxxxxxxxxx12345
But these two don't:
#define button 2 // this is 80 chars long this is 80 chars longxxxxxxxxxxxxx1234
const int xyz = 0; // this is 80 chars long this is 80 chars longxxxxxxxxxxx1234
Splits look like this:
#define button \
2 // this is 81 chars long this is 81 chars longxxxxxxxxxxxxx12345
const int xyz =
0; // this is 81 chars long this is 81 chars longxxxxxxxxxxx12345
Formatted the code by either Alt-Shift-F or Ctrl-T or Popup menu
I also added characters to the lines (100 characters per line) but they did not split. The same applied after narrowing and restoring the window width.
It might be a configuration issue or OS dependend?
An entry of "ColumnLimit: 0" in the .clang-format file should switch off the automatic line wrapping. I'm not sure if this is the source of your problem but you could give it a try ...
You could also use block comments. I use very few, and if I have to look at someone else's code, I delete them all, as they are almost always not kept up to date with the code and are just misleading. Well-written code is self-documenting.
Then I'm guessing you were already using a custom formatter configuration.
The reason is that Arduino IDE's built-in formatter configuration already has this:
Note that if you use a custom ClangFormat configuration file, it is used instead of the built-in configuration file. If you don't define a given configuration key in your custom config file, ClangFormat will use whatever is the default value for that option (which will depend on the value of the BasedOnStyle key in your configuration file). For this reason, I would recommend defining all available format options in your custom configuration file, even in the case where you currently find the default to be fine. The official Arduino ClangFormat configuration can be used as a good starting point for that, as it does define all options: