Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | josh__ |
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | josh__ |
Reply From: | Calinou |
Godot doesn’t have an option to not add a blank line at the end of scripts. However, it’s considered good practice to add a blank line at the end of files for two reasons:
cat
, your prompt will appear on the same line as the last line of the file, which looks ugly.While I like this setting on actual scripts for the mentioned reasons, I do have a counter example: I have a raw .txt file I use for data (credits text) which I display in a label inside a ScrollContainer. Not adding a final line allows me to keep the text as compact as possible so I don’t display the scrollbars unnecessarily. If the text happens to be just fitting right, the blank newline will still cause the scrollbar to appear.
My current workaround is to use text.strip_edges(false, true) to strip any trailing whitespaces/blank lines.
(and of course you can edit the file in an external editor, if you don’t care about the 2 issues mentioned above)
Hyper Sonic | 2023-05-05 13:29