-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix alignment of strings with preprocessor concatenations #3723
base: master
Are you sure you want to change the base?
Fix alignment of strings with preprocessor concatenations #3723
Conversation
@guy-maurel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- please do not use 'prev' directly, use "GetPrev()" to access it.
- we should add "negative tests" as well, showing the behavior with the option set an not set.
{ | ||
Chunk *tmp = prev; | ||
|
||
while ( tmp->prev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should use "GetPrev()" instead of "prev", which also takes away the need for the first check in the while loop.
By the way, welcome to uncrustify, good effort! |
a fine work. |
Chunk *tmp = prev; | ||
|
||
while ( tmp->prev | ||
&& (tmp->prev->Is(CT_WORD) || tmp->prev->Is(CT_STRING))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also break and indent the while condition as per current style.
this has been done, no regressions 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine work, thanks and welcome
@ArnauBigas |
Fixes #3086
As described in the related issue, the alignment of strings in a new line after a string which is concatenated by the C/C++ preprocessor is unintuitive in the current version of the code. This PR addresses that by aligning the string in the new line to the start of the string of the previous line, taking into account the possible concatenations, making the indentation/alignment much more intuitive.