You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-04 17:04:49 +00:00
Merge pull request #76658 from Paulb23/convert-indent-code-edit
Move convert_indent into CodeEdit
This commit is contained in:
@@ -944,11 +944,7 @@ void ScriptEditor::_resave_scripts(const String &p_str) {
|
||||
se->insert_final_newline();
|
||||
|
||||
if (convert_indent_on_save) {
|
||||
if (use_space_indentation) {
|
||||
se->convert_indent_to_spaces();
|
||||
} else {
|
||||
se->convert_indent_to_tabs();
|
||||
}
|
||||
se->convert_indent();
|
||||
}
|
||||
|
||||
Ref<TextFile> text_file = scr;
|
||||
@@ -1299,11 +1295,7 @@ void ScriptEditor::_menu_option(int p_option) {
|
||||
current->insert_final_newline();
|
||||
|
||||
if (convert_indent_on_save) {
|
||||
if (use_space_indentation) {
|
||||
current->convert_indent_to_spaces();
|
||||
} else {
|
||||
current->convert_indent_to_tabs();
|
||||
}
|
||||
current->convert_indent();
|
||||
}
|
||||
|
||||
Ref<Resource> resource = current->get_edited_resource();
|
||||
@@ -2451,11 +2443,7 @@ void ScriptEditor::save_current_script() {
|
||||
current->insert_final_newline();
|
||||
|
||||
if (convert_indent_on_save) {
|
||||
if (use_space_indentation) {
|
||||
current->convert_indent_to_spaces();
|
||||
} else {
|
||||
current->convert_indent_to_tabs();
|
||||
}
|
||||
current->convert_indent();
|
||||
}
|
||||
|
||||
Ref<Resource> resource = current->get_edited_resource();
|
||||
@@ -2499,11 +2487,7 @@ void ScriptEditor::save_all_scripts() {
|
||||
}
|
||||
|
||||
if (convert_indent_on_save) {
|
||||
if (use_space_indentation) {
|
||||
se->convert_indent_to_spaces();
|
||||
} else {
|
||||
se->convert_indent_to_tabs();
|
||||
}
|
||||
se->convert_indent();
|
||||
}
|
||||
|
||||
if (trim_trailing_whitespace_on_save) {
|
||||
@@ -2730,7 +2714,6 @@ void ScriptEditor::_editor_settings_changed() {
|
||||
|
||||
trim_trailing_whitespace_on_save = EDITOR_GET("text_editor/behavior/files/trim_trailing_whitespace_on_save");
|
||||
convert_indent_on_save = EDITOR_GET("text_editor/behavior/files/convert_indent_on_save");
|
||||
use_space_indentation = EDITOR_GET("text_editor/behavior/indent/type");
|
||||
|
||||
members_overview_enabled = EDITOR_GET("text_editor/script_list/show_members_overview");
|
||||
help_overview_enabled = EDITOR_GET("text_editor/help/show_help_index");
|
||||
@@ -4081,7 +4064,6 @@ ScriptEditor::ScriptEditor() {
|
||||
edit_pass = 0;
|
||||
trim_trailing_whitespace_on_save = EDITOR_GET("text_editor/behavior/files/trim_trailing_whitespace_on_save");
|
||||
convert_indent_on_save = EDITOR_GET("text_editor/behavior/files/convert_indent_on_save");
|
||||
use_space_indentation = EDITOR_GET("text_editor/behavior/indent/type");
|
||||
|
||||
ScriptServer::edit_request_func = _open_script_request;
|
||||
|
||||
|
||||
@@ -169,8 +169,7 @@ public:
|
||||
virtual void clear_executing_line() = 0;
|
||||
virtual void trim_trailing_whitespace() = 0;
|
||||
virtual void insert_final_newline() = 0;
|
||||
virtual void convert_indent_to_spaces() = 0;
|
||||
virtual void convert_indent_to_tabs() = 0;
|
||||
virtual void convert_indent() = 0;
|
||||
virtual void ensure_focus() = 0;
|
||||
virtual void tag_saved_version() = 0;
|
||||
virtual void reload(bool p_soft) {}
|
||||
@@ -390,7 +389,6 @@ class ScriptEditor : public PanelContainer {
|
||||
|
||||
bool open_textfile_after_create = true;
|
||||
bool trim_trailing_whitespace_on_save;
|
||||
bool use_space_indentation;
|
||||
bool convert_indent_on_save;
|
||||
|
||||
void _goto_script_line2(int p_line);
|
||||
|
||||
@@ -378,12 +378,8 @@ void ScriptTextEditor::insert_final_newline() {
|
||||
code_editor->insert_final_newline();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::convert_indent_to_spaces() {
|
||||
code_editor->convert_indent_to_spaces();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::convert_indent_to_tabs() {
|
||||
code_editor->convert_indent_to_tabs();
|
||||
void ScriptTextEditor::convert_indent() {
|
||||
code_editor->get_text_editor()->convert_indent();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::tag_saved_version() {
|
||||
@@ -1282,10 +1278,12 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
||||
trim_trailing_whitespace();
|
||||
} break;
|
||||
case EDIT_CONVERT_INDENT_TO_SPACES: {
|
||||
convert_indent_to_spaces();
|
||||
tx->set_indent_using_spaces(true);
|
||||
convert_indent();
|
||||
} break;
|
||||
case EDIT_CONVERT_INDENT_TO_TABS: {
|
||||
convert_indent_to_tabs();
|
||||
tx->set_indent_using_spaces(false);
|
||||
convert_indent();
|
||||
} break;
|
||||
case EDIT_PICK_COLOR: {
|
||||
color_panel->popup();
|
||||
|
||||
@@ -222,8 +222,7 @@ public:
|
||||
virtual void ensure_focus() override;
|
||||
virtual void trim_trailing_whitespace() override;
|
||||
virtual void insert_final_newline() override;
|
||||
virtual void convert_indent_to_spaces() override;
|
||||
virtual void convert_indent_to_tabs() override;
|
||||
virtual void convert_indent() override;
|
||||
virtual void tag_saved_version() override;
|
||||
|
||||
virtual void goto_line(int p_line, bool p_with_error = false) override;
|
||||
|
||||
@@ -288,12 +288,8 @@ void TextEditor::insert_final_newline() {
|
||||
code_editor->insert_final_newline();
|
||||
}
|
||||
|
||||
void TextEditor::convert_indent_to_spaces() {
|
||||
code_editor->convert_indent_to_spaces();
|
||||
}
|
||||
|
||||
void TextEditor::convert_indent_to_tabs() {
|
||||
code_editor->convert_indent_to_tabs();
|
||||
void TextEditor::convert_indent() {
|
||||
code_editor->get_text_editor()->convert_indent();
|
||||
}
|
||||
|
||||
void TextEditor::tag_saved_version() {
|
||||
@@ -419,10 +415,12 @@ void TextEditor::_edit_option(int p_op) {
|
||||
trim_trailing_whitespace();
|
||||
} break;
|
||||
case EDIT_CONVERT_INDENT_TO_SPACES: {
|
||||
convert_indent_to_spaces();
|
||||
tx->set_indent_using_spaces(true);
|
||||
convert_indent();
|
||||
} break;
|
||||
case EDIT_CONVERT_INDENT_TO_TABS: {
|
||||
convert_indent_to_tabs();
|
||||
tx->set_indent_using_spaces(false);
|
||||
convert_indent();
|
||||
} break;
|
||||
case EDIT_TO_UPPERCASE: {
|
||||
_convert_case(CodeTextEditor::UPPER);
|
||||
|
||||
@@ -131,8 +131,7 @@ public:
|
||||
virtual void clear_executing_line() override;
|
||||
virtual void trim_trailing_whitespace() override;
|
||||
virtual void insert_final_newline() override;
|
||||
virtual void convert_indent_to_spaces() override;
|
||||
virtual void convert_indent_to_tabs() override;
|
||||
virtual void convert_indent() override;
|
||||
virtual void ensure_focus() override;
|
||||
virtual void tag_saved_version() override;
|
||||
virtual void update_settings() override;
|
||||
|
||||
Reference in New Issue
Block a user