Implement trim_final_newlines functionality

This commit is contained in:
Aiden Storey 2024-01-12 00:32:13 -05:00
parent d4f726f3ef
commit b4c1634b52
13 changed files with 99 additions and 4 deletions

View file

@ -756,6 +756,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) {
@ -920,6 +921,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();
@ -946,6 +951,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();
}