–1 vote

I use Godot Editor 3.2 to edit an existing project. But it auto add a blank line at the end of file. How to I disable this behavior?

in Engine by (11 points)

1 Answer

+2 votes

There's not really a blank line added to your document. If you look at the script file in a hex editor, you'll see that it simply ends with an OA character - which is a newline.

So, really, every line in the file (including the last line) ends with a newline character. I assume the editor just chooses to render that case visually with a new line, but it doesn't actually exist in the file until you add content to it.

If you look at your file in (for example) VS Code, it'll render the same way (with a visual blank at the end).

by (21,864 points)

Moreover, it's considered good practice to end all files with a newline (as per the POSIX specification).

See my comment on https://godotengine.org/qa/119848/godot-creating-new-line-when-save-the-project-and-want-disable for the case of loading text as a resource, where it can bring a visual difference, and a workaround)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.