summaryrefslogtreecommitdiffstats
path: root/editor/plugins/text_shader_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/text_shader_editor.cpp')
-rw-r--r--editor/plugins/text_shader_editor.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/editor/plugins/text_shader_editor.cpp b/editor/plugins/text_shader_editor.cpp
index d6cef3ccb9..fb8bed381e 100644
--- a/editor/plugins/text_shader_editor.cpp
+++ b/editor/plugins/text_shader_editor.cpp
@@ -770,6 +770,7 @@ void TextShaderEditor::_apply_editor_settings() {
code_editor->update_editor_settings();
trim_trailing_whitespace_on_save = EDITOR_GET("text_editor/behavior/files/trim_trailing_whitespace_on_save");
+ trim_final_newlines_on_save = EDITOR_GET("text_editor/behavior/files/trim_final_newlines_on_save");
}
void TextShaderEditor::_show_warnings_panel(bool p_show) {
@@ -934,6 +935,10 @@ void TextShaderEditor::save_external_data(const String &p_str) {
trim_trailing_whitespace();
}
+ if (trim_final_newlines_on_save) {
+ trim_final_newlines();
+ }
+
apply_shaders();
Ref<Shader> edited_shader = code_editor->get_edited_shader();
@@ -960,6 +965,10 @@ void TextShaderEditor::trim_trailing_whitespace() {
code_editor->trim_trailing_whitespace();
}
+void TextShaderEditor::trim_final_newlines() {
+ code_editor->trim_final_newlines();
+}
+
void TextShaderEditor::validate_script() {
code_editor->_validate_script();
}