Skip to content

Don't right-align escaped newlines (e.g. for #define)#112381

Merged
Repiteo merged 2 commits into
godotengine:masterfrom
Ivorforce:no-right-align
Feb 5, 2026
Merged

Don't right-align escaped newlines (e.g. for #define)#112381
Repiteo merged 2 commits into
godotengine:masterfrom
Ivorforce:no-right-align

Conversation

@Ivorforce

@Ivorforce Ivorforce commented Nov 4, 2025

Copy link
Copy Markdown
Member

Removes whitespace indentation for escaped newlines.

Motivation

This decouples the lines from one another for git diff purposes: When the backslashes are right-aligned, a change to the max size of the block changes all lines in it.
This leads to unnecessarily long change lists, increasing the chance and difficulty of merge conflicts, and makes it harder to view changes to these blocks in GitHub (e.g. https://github.com/godotengine/godot/pull/78971/files, though notably, the "hide whitespace" option helps, if you know it exists). In addition, the git blame is unnecessarily modified, and line history browsers are harder to use.

It also makes it hard to hand-align these blocks, which means you need to run pre-commit while working on the code, or risk pre-commit changing it later. For me, this has led to unnecessary local recompilations.

Downsides

The main downside to this is that the code is arguably harder to read.
Given that C macros lead to difficult to read and error-prone code (for example, they are not hygienic), we should be limiting their use anyway (and we do, for the most part). So I think this is an acceptable caveat.

@Ivorforce Ivorforce requested review from a team as code owners November 4, 2025 10:15
@Ivorforce Ivorforce requested review from a team November 4, 2025 10:15
@Ivorforce Ivorforce requested review from a team as code owners November 4, 2025 10:15
@Ivorforce Ivorforce removed request for a team November 4, 2025 10:16
@bruvzg

bruvzg commented Nov 4, 2025

Copy link
Copy Markdown
Member

The main downside to this is that the code is arguably harder to read.

Since it's space aligned and the rest of code use tab indentation, it's already a mess unless you are using the same tab size. So it's actually might improve readability in some cases.

@AThousandShips

Copy link
Copy Markdown
Member

If it were possible to force it to add a few more spaces after each line I think that would help any readability concerns from this but I don't think clang supports that

@Repiteo Repiteo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved in buildsystem meeting! Will be good to merge after a rebase

@Repiteo Repiteo modified the milestones: 4.x, 4.7 Feb 4, 2026
@Ivorforce Ivorforce requested a review from a team as a code owner February 4, 2026 22:35
@Ivorforce Ivorforce removed the request for review from a team February 4, 2026 22:37
@Repiteo Repiteo merged commit 79eb669 into godotengine:master Feb 5, 2026
20 checks passed
@Repiteo

Repiteo commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

Thanks!

@Ivorforce Ivorforce deleted the no-right-align branch February 5, 2026 15:21
rivie13 pushed a commit to rivie13/Phoenix-Agentic-Engine that referenced this pull request Feb 16, 2026
Don't right-align escaped newlines (e.g. for `#define`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment