summaryrefslogtreecommitdiffstats
path: root/editor/plugins/shader_editor_plugin.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-05-30 11:47:28 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-05-30 11:47:28 +0200
commit838eb5a0fdcfa0e0f368a6d33a0f712db90c9719 (patch)
tree565c508efbc85bac44c367ba697277882b0c1df6 /editor/plugins/shader_editor_plugin.cpp
parentffad49f1693cc292df88955573e8fe197a41bcd0 (diff)
parentb4c1634b52f619ca8987b67ecee2640310781aa7 (diff)
downloadredot-engine-838eb5a0fdcfa0e0f368a6d33a0f712db90c9719.tar.gz
Merge pull request #87099 from bitwise-aiden/ba-add-trim-newlines
Implement `trim_final_newlines` setting and functionality
Diffstat (limited to 'editor/plugins/shader_editor_plugin.cpp')
-rw-r--r--editor/plugins/shader_editor_plugin.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 222d010a7a..a83f95f680 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -436,8 +436,14 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
int index = shader_tabs->get_current_tab();
ERR_FAIL_INDEX(index, shader_tabs->get_tab_count());
TextShaderEditor *editor = edited_shaders[index].shader_editor;
- if (editor && editor->get_trim_trailing_whitespace_on_save()) {
- editor->trim_trailing_whitespace();
+ if (editor) {
+ if (editor->get_trim_trailing_whitespace_on_save()) {
+ editor->trim_trailing_whitespace();
+ }
+
+ if (editor->get_trim_final_newlines_on_save()) {
+ editor->trim_final_newlines();
+ }
}
if (edited_shaders[index].shader.is_valid()) {
EditorNode::get_singleton()->save_resource(edited_shaders[index].shader);
@@ -452,8 +458,14 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
int index = shader_tabs->get_current_tab();
ERR_FAIL_INDEX(index, shader_tabs->get_tab_count());
TextShaderEditor *editor = edited_shaders[index].shader_editor;
- if (editor && editor->get_trim_trailing_whitespace_on_save()) {
- editor->trim_trailing_whitespace();
+ if (editor) {
+ if (editor->get_trim_trailing_whitespace_on_save()) {
+ editor->trim_trailing_whitespace();
+ }
+
+ if (editor->get_trim_final_newlines_on_save()) {
+ editor->trim_final_newlines();
+ }
}
String path;
if (edited_shaders[index].shader.is_valid()) {