It is related to the last line of the raw string having no indent. It seems to be an older bug or regression.
The two examples above are "complete" meaning, pasting each of them into a new cpp file and formatting keeps them unchanged (with the Astyle config from above), rather than fixing the broken switch and lambda layouts. This was tested with your latest version from Jan 30th, freshly compiled from gitlab. For some reason the presence of the raw string literals is responsible for the layout corruption. When deleting them, both the lambda and switch lay out correctly.
The two examples above are "complete" meaning, pasting each of them into a new cpp file and formatting keeps them unchanged (with the Astyle config from above), rather than fixing the broken switch and lambda layouts. This was tested with your latests version from Jan 30th, freshly compiled from gitlab. For some reason the presence of the raw string literals is responsible for the layout corruption. When deleting them, both the lambda and switch lay out correctly.
Hi, is it possible the bad formatting is triggered by other code before? I cannot replicate your isolated examples (not related to the last change).
The raw string literals seem to be preserved now, unfortunately there are regressions: For example the layout of the switch statement in the following test sample is broken (using same astyle config as above): std::string test() { return std::string(R"( <tr> <td>)") + R"(</td> <td><span style="font-weight: 600;">)" + R"(</span></td> )"; } void generateLogFileName(const ProcessSummary& summary) { const std::wstring failStatus = [&] { switch (summary.result) { case TaskResult::success: break; case...
I pushed a fix to git
updated version to 3.6.14
I pushed a fix in the git repo.
I have pushed a fix to the git repo
Unexpected indent in immediately called lambda
Lines starting with #define and end with ',' are pre-padded with space
duplicate issue
Negative numbers are aligned and others not
Lines starting with #define and end with ',' are pre-padded with space
Negative numbers are aligned and others not
Lines starting with #define and end with ',' are pre-padded with space
Lines starting with #define and end with ',' are pre-padded with space
updated version to 3.6.12
I get this too in ver. 3.6.12. An align-pointer=name has no effect on e.g. this: protected: virtual void DoDataExchange (CDataExchange* pDX); DECLARE_MESSAGE_MAP() I want virtual void DoDataExchange (CDataExchange *pDX); but astyle does not make it so.
Hi, Please ignore this issue as I was not able to reproduce it. Sorry for the inconvenience. Thanks!
When Astyle fails to open a specified file, the file is emptied
Thx, I pushed an update into the git repo
Hello Simon, Thank you for your reply an for looking at this, Unfortunately I tested on the version 3.6.10 and it seems that the lamdas are no longer indented Original indenting int func() { auto addLambda = [](int a, int b) { return a + b; }; } Then I run astyle-3.6.10-x64> .\astyle.exe --style=allman --indent=spaces=3 --indent-lambda MyFile.c Which gives me int func() { auto addLambda = [](int a, int b) { return a + b; }; } While in version 3.6.7 I have int func() { auto addLambda = [](int a, int...
Hello, I tested on the version 3.6.10 and it seems that the lamdas are no longer indented Original indenting int func() { auto addLambda = [](int a, int b) { return a + b; }; } Then I run astyle-3.6.10-x64> .\astyle.exe --style=allman --indent=spaces=3 --indent-lambda MyFile.c Which gives me int func() { auto addLambda = [](int a, int b) { return a + b; }; } While in version 3.6.7 I have int func() { auto addLambda = [](int a, int b) { return a + b; }; }
Hello, I tested on the version 3.6.10 and it seems that the lamdas are no longer indented Original indenting int func() { auto addLambda = [](int a, int b) { return a + b; }; } Then I run astyle-3.6.10-x64> .\astyle.exe --style=allman --indent=spaces=3 --indent-lambda MyFile.c Which gives me int func() { auto addLambda = [](int a, int b) { return a + b; }; } While in version 3.6.7 I have int func() { auto addLambda = [](int a, int b) { return a + b; }; }
Unexpected indent in immediately called lambda
Hi, please try again with 3.6.10
Please try with 3.6.10.
I have pushed a fix to the repo
Hi Marco, adding a single space after // also increases readability for humans. Therefore, many style guides prescribe this type of visual padding between the “frame” of the comment and its content.
Hello @saalen, yes, there are some rows of code: #include <string.h> #include <stdlib.h> #include <stdio.h> /////////////////////////////////////////////////////////// // INCLUDE COMUNI /////////////////////////////////////////////////////////// #include "configBase.h" #include "errorCode.h"//serve x AP_ERR #include "message.h" #include "myLib.h"//serve per AM #include "apEnum.h" #include "vegaassert.h" /////////////////////////////////////////////////////////// // INCLUDE SPECIFICI ///////////////////////////////////////////////////////////...
References in lambda parameter lists are not formatted according to --align-reference=type
Hi, is there any code before this function to trigger this?
indentation preprocessor inside functions
--align-pointer=type and --align-reference=type behave incorrectly
The problem with * ptr = 10; is still present in 3.6.9
The problem with * ptr = 10; still present in 3.6.9
Could you please add your examples as text like this: ```cpp verbatim copy of your code section goes here ``` The images are very small and are placed in the wrong place when clicked. In addition, they cannot be copied to easily verify the problem and possible fixes. And finally: Which Artistic Style version do you use?
Could you please add your examples as text like this: ```cpp verbatim copy of your code section goes here ``` The images are very small and are placed in the wrong place when clicked. In addition, they cannot be copied to easily verify the problem and possible fixes. Which version are you using?
With example 3
With example 2
With example 1
Issue with indenting if without brackets and if-else (with or without brackets) when in a lambda block.
AStyle 3.6.7: class modifiers indentation
AStyle 3.6.7: wrong indentation of multi-line assignment
astyle 3.6.8 (git 2025-03-14): incorrect using indentation
astyle 3.6.8 (git 2025-03-14): incorrect function-scope class indentation
astyle 3.6.8 (git 2025-03-17): unexpected linebreak for inherited class
Unwanted indentation after >>>
Unexpected change of raw string literal
I have pushed a fix for the first problem (pointer reference). It works correctly now, thanks! The second you can inmprove with --squeeze-ws. But only int will be recognized as a type, this is a limitation of the current parser. Hopfully this function can be restored again at some time. I've been relying on it a lot in Astyle 3.1 to normalize third-party codebases, especially all the function signatures.
I have pushed a fix for the first problem (pointer reference). The second you can inmprove with --squeeze-ws. But only int will be recognized as a type, this is a limitation of the current parser.
There seems to be a more general issue: Astyle keeps the following code unchanged: void test(int* test) { wxWindow * const win = nullptr; int* const win = nullptr; std::vector<std::pair<int, int>> * const win = nullptr; } expected: void test(int* test) { wxWindow* const win = nullptr; int* const win = nullptr; std::vector<std::pair<int, int>>* const win = nullptr; }
Perfect, the issue has been fixed!
Unwanted indentation after >>>
I pushed a fix for this one (Java operators confusion)
Preserve one-liners in switch
I just realized there is "--keep-one-line-statements", and it works for switches, too!! Ticket can be closed! :)
Sorry, this should have been filed under "Feature Requests", not "Bugs".
My Astyle config used: --style=allman --suffix=none --keep-one-line-blocks --align-pointer=type --min-conditional-indent=0 --max-continuation-indent=80 --indent-switches --indent-col1-comments --indent-preproc-block --indent-preproc-define --pad-header --pad-comma --formatted --lineend=linux --indent-preproc-block --convert-tabs --preserve-ws
Preserve one-liners in switch
Unexpected change of raw string literal
There is also the opposite case: AStyle produces: auto test() { return { .ai_flags = AI_ADDRCONFIG | AI_PASSIVE }; } while the expected result is: auto test() { return { .ai_flags = AI_ADDRCONFIG | AI_PASSIVE }; }
Unwanted indentation after >>>
Unwanted space between *&
Wrong indendation when returning struct
The ticked can be closed! Apparently the latest changes to https://sourceforge.net/p/astyle/bugs/585/ fixed this one as well! Thanks!
Thank you! :) Ticket can be closed.
Thinking about it, the expected result is probably better this one: template <typename... Ts> struct is_proxy_type_list<ProxyTypeList<Ts...>> : std::true_type {}; template <typename T> struct GenerateTypeList { private: using proxy = typename std::conditional<is_proxy_type_list<T>::value, T, ProxyTypeList<T>>::type; }; But with your latest changes, the current code produces: template <typename T> struct GenerateTypeList { private: using proxy = typename std::conditional<is_proxy_type_list<T>::value,...
The ticked can be closed! Apparently the latest changes to https://sourceforge.net/p/astyle/bugs/585/ fixed this one as well! Thanks!
Awesome! I seem to have run out of any more of these issues :D The ticket can probably be closed.
I have pushed another variant of the fix.
Please try again with the latest version in git.
This issue should be fixed! See https://sourceforge.net/p/astyle/bugs/585/
astyle 3.6.8 (git 2025-03-17): unexpected linebreak for inherited class
Alas, one problematic "switch" remains: struct TreeView { bool operator()(const TreeLine& lhs, const TreeLine& rhs) { switch (lhs.type) { case NodeType::root: return true; case NodeType::folder: { const auto* folderL = nullptr; if (!folderL) return false; return true; } case NodeType::files: break; } assert(false); return false; } };
The issue seems to be fixed!
Here's a probably related issue with function "missingIndent()": void test(const std::vector<std::pair<int, int>>& workload) { } class NativeFileSystem { public: Zstring missingIndent() const { return isNullFileSystem() ? Zstring{} : rootPath_; } };
This is a major improvement! Most issues are gone, but not the following: class GdriveFileState { public: std::optional<std::vector<int>> tryGetBufferedFolderContent() { return {}; } struct FileStateDelta { FileStateDelta() {} private: int test = 0; }; };
astyle 3.6.8 (git 2025-03-14): incorrect switch indentation
astyle 3.6.8 (git 2025-03-14): incorrect using indentation
Please try these cases with the latest git version.