Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks

Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
This commit is contained in:
Rémi Verschelde 2020-05-14 13:23:58 +02:00
parent 710b34b702
commit 0be6d925dc
1552 changed files with 1 additions and 33876 deletions

View file

@ -109,7 +109,6 @@ ConnectionInfoDialog::ConnectionInfoDialog() {
////////////////////////////////////////////////////////////////////////////////
Vector<String> ScriptTextEditor::get_functions() {
String errortxt;
int line = -1, col;
TextEdit *te = code_editor->get_text_edit();
@ -117,11 +116,9 @@ Vector<String> ScriptTextEditor::get_functions() {
List<String> fnc;
if (script->get_language()->validate(text, line, col, errortxt, script->get_path(), &fnc)) {
//if valid rewrite functions to latest
functions.clear();
for (List<String>::Element *E = fnc.front(); E; E = E->next()) {
functions.push_back(E->get());
}
}
@ -130,7 +127,6 @@ Vector<String> ScriptTextEditor::get_functions() {
}
void ScriptTextEditor::apply_code() {
if (script.is_null())
return;
script->set_source_code(code_editor->get_text_edit()->get_text());
@ -184,13 +180,11 @@ void ScriptTextEditor::_update_member_keywords() {
ClassDB::get_integer_constant_list(instance_base, &clist);
for (List<String>::Element *E = clist.front(); E; E = E->next()) {
code_editor->get_text_edit()->add_member_keyword(E->get(), member_variable_color);
}
}
void ScriptTextEditor::_load_theme_settings() {
TextEdit *text_edit = code_editor->get_text_edit();
text_edit->clear_colors();
@ -275,7 +269,6 @@ void ScriptTextEditor::_load_theme_settings() {
}
void ScriptTextEditor::_set_theme_for_script() {
if (!theme_loaded)
return;
@ -285,7 +278,6 @@ void ScriptTextEditor::_set_theme_for_script() {
script->get_language()->get_reserved_words(&keywords);
for (List<String>::Element *E = keywords.front(); E; E = E->next()) {
text_edit->add_keyword_color(E->get(), colors_cache.keyword_color);
}
@ -327,7 +319,6 @@ void ScriptTextEditor::_set_theme_for_script() {
ClassDB::get_class_list(&types);
for (List<StringName>::Element *E = types.front(); E; E = E->next()) {
String n = E->get();
if (n.begins_with("_"))
n = n.substr(1, n.length());
@ -341,7 +332,6 @@ void ScriptTextEditor::_set_theme_for_script() {
ScriptServer::get_global_class_list(&global_classes);
for (List<StringName>::Element *E = global_classes.front(); E; E = E->next()) {
text_edit->add_keyword_color(E->get(), colors_cache.usertype_color);
}
@ -364,7 +354,6 @@ void ScriptTextEditor::_set_theme_for_script() {
script->get_language()->get_comment_delimiters(&comments);
for (List<String>::Element *E = comments.front(); E; E = E->next()) {
String comment = E->get();
String beg = comment.get_slice(" ", 0);
String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
@ -376,7 +365,6 @@ void ScriptTextEditor::_set_theme_for_script() {
List<String> strings;
script->get_language()->get_string_delimiters(&strings);
for (List<String>::Element *E = strings.front(); E; E = E->next()) {
String string = E->get();
String beg = string.get_slice(" ", 0);
String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
@ -403,7 +391,6 @@ void ScriptTextEditor::_warning_clicked(Variant p_line) {
}
void ScriptTextEditor::reload_text() {
ERR_FAIL_COND(script.is_null());
TextEdit *te = code_editor->get_text_edit();
@ -424,7 +411,6 @@ void ScriptTextEditor::reload_text() {
}
void ScriptTextEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY:
_load_theme_settings();
@ -433,7 +419,6 @@ void ScriptTextEditor::_notification(int p_what) {
}
void ScriptTextEditor::add_callback(const String &p_function, PackedStringArray p_args) {
String code = code_editor->get_text_edit()->get_text();
int pos = script->get_language()->find_function(p_function, code);
if (pos == -1) {
@ -455,22 +440,18 @@ bool ScriptTextEditor::show_members_overview() {
}
void ScriptTextEditor::update_settings() {
code_editor->update_editor_settings();
}
bool ScriptTextEditor::is_unsaved() {
return code_editor->get_text_edit()->get_version() != code_editor->get_text_edit()->get_saved_version();
}
Variant ScriptTextEditor::get_edit_state() {
return code_editor->get_edit_state();
}
void ScriptTextEditor::set_edit_state(const Variant &p_state) {
code_editor->set_edit_state(p_state);
Dictionary state = p_state;
@ -483,47 +464,38 @@ void ScriptTextEditor::set_edit_state(const Variant &p_state) {
}
void ScriptTextEditor::_convert_case(CodeTextEditor::CaseStyle p_case) {
code_editor->convert_case(p_case);
}
void ScriptTextEditor::trim_trailing_whitespace() {
code_editor->trim_trailing_whitespace();
}
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::tag_saved_version() {
code_editor->get_text_edit()->tag_saved_version();
}
void ScriptTextEditor::goto_line(int p_line, bool p_with_error) {
code_editor->goto_line(p_line);
}
void ScriptTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
code_editor->goto_line_selection(p_line, p_begin, p_end);
}
void ScriptTextEditor::goto_line_centered(int p_line) {
code_editor->goto_line_centered(p_line);
}
@ -536,7 +508,6 @@ void ScriptTextEditor::clear_executing_line() {
}
void ScriptTextEditor::ensure_focus() {
code_editor->get_text_edit()->grab_focus();
}
@ -557,7 +528,6 @@ String ScriptTextEditor::get_name() {
}
Ref<Texture2D> ScriptTextEditor::get_theme_icon() {
if (get_parent_control() && get_parent_control()->has_theme_icon(script->get_class(), "EditorIcons")) {
return get_parent_control()->get_theme_icon(script->get_class(), "EditorIcons");
}
@ -566,7 +536,6 @@ Ref<Texture2D> ScriptTextEditor::get_theme_icon() {
}
void ScriptTextEditor::_validate_script() {
String errortxt;
int line = -1, col;
TextEdit *te = code_editor->get_text_edit();
@ -592,7 +561,6 @@ void ScriptTextEditor::_validate_script() {
functions.clear();
for (List<String>::Element *E = fnc.front(); E; E = E->next()) {
functions.push_back(E->get());
}
script_is_valid = true;
@ -682,7 +650,6 @@ void ScriptTextEditor::_validate_script() {
}
void ScriptTextEditor::_update_bookmark_list() {
bookmarks_menu->clear();
bookmarks_menu->set_size(Size2(1, 1));
@ -714,7 +681,6 @@ void ScriptTextEditor::_update_bookmark_list() {
}
void ScriptTextEditor::_bookmark_item_pressed(int p_idx) {
if (p_idx < 4) { // Any item before the separator.
_edit_option(bookmarks_menu->get_item_id(p_idx));
} else {
@ -724,7 +690,6 @@ void ScriptTextEditor::_bookmark_item_pressed(int p_idx) {
}
static Vector<Node *> _find_all_node_for_script(Node *p_base, Node *p_current, const Ref<Script> &p_script) {
Vector<Node *> nodes;
if (p_current->get_owner() != p_base && p_base != p_current) {
@ -745,7 +710,6 @@ static Vector<Node *> _find_all_node_for_script(Node *p_base, Node *p_current, c
}
static Node *_find_node_for_script(Node *p_base, Node *p_current, const Ref<Script> &p_script) {
if (p_current->get_owner() != p_base && p_base != p_current)
return nullptr;
Ref<Script> c = p_current->get_script();
@ -761,7 +725,6 @@ static Node *_find_node_for_script(Node *p_base, Node *p_current, const Ref<Scri
}
static void _find_changed_scripts_for_external_editor(Node *p_base, Node *p_current, Set<Ref<Script>> &r_scripts) {
if (p_current->get_owner() != p_base && p_base != p_current)
return;
Ref<Script> c = p_current->get_script();
@ -775,7 +738,6 @@ static void _find_changed_scripts_for_external_editor(Node *p_base, Node *p_curr
}
void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_for_script) {
if (!bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")))
return;
@ -789,14 +751,12 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo
}
for (Set<Ref<Script>>::Element *E = scripts.front(); E; E = E->next()) {
Ref<Script> script = E->get();
if (p_for_script.is_valid() && p_for_script != script)
continue;
if (script->get_path() == "" || script->get_path().find("local://") != -1 || script->get_path().find("::") != -1) {
continue; //internal script, who cares, though weird
}
@ -804,7 +764,6 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo
uint64_t date = FileAccess::get_modified_time(script->get_path());
if (last_date != date) {
Ref<Script> rel_script = ResourceLoader::load(script->get_path(), script->get_class(), true);
ERR_CONTINUE(!rel_script.is_valid());
script->set_source_code(rel_script->get_source_code());
@ -815,13 +774,11 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo
}
void ScriptTextEditor::_code_complete_scripts(void *p_ud, const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) {
ScriptTextEditor *ste = (ScriptTextEditor *)p_ud;
ste->_code_complete_script(p_code, r_options, r_force);
}
void ScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) {
if (color_panel->is_visible())
return;
Node *base = get_tree()->get_edited_scene_root();
@ -836,7 +793,6 @@ void ScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptCo
}
void ScriptTextEditor::_update_breakpoint_list() {
breakpoints_menu->clear();
breakpoints_menu->set_size(Size2(1, 1));
@ -868,7 +824,6 @@ void ScriptTextEditor::_update_breakpoint_list() {
}
void ScriptTextEditor::_breakpoint_item_pressed(int p_idx) {
if (p_idx < 4) { // Any item before the separator.
_edit_option(breakpoints_menu->get_item_id(p_idx));
} else {
@ -878,12 +833,10 @@ void ScriptTextEditor::_breakpoint_item_pressed(int p_idx) {
}
void ScriptTextEditor::_breakpoint_toggled(int p_row) {
EditorDebuggerNode::get_singleton()->set_breakpoint(script->get_path(), p_row + 1, code_editor->get_text_edit()->is_line_set_as_breakpoint(p_row));
}
void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_column) {
Node *base = get_tree()->get_edited_scene_root();
if (base) {
base = _find_node_for_script(base, base, script);
@ -903,14 +856,12 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
}
} else if (script->get_language()->lookup_code(code_editor->get_text_edit()->get_text_for_lookup_completion(), p_symbol, script->get_path(), base, result) == OK) {
_goto_line(p_row);
result.class_name = result.class_name.trim_prefix("_");
switch (result.type) {
case ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION: {
if (result.script.is_valid()) {
emit_signal("request_open_script_at_line", result.script, result.location - 1);
} else {
@ -922,7 +873,6 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
emit_signal("go_to_help", "class_name:" + result.class_name);
} break;
case ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT: {
StringName cname = result.class_name;
bool success;
while (true) {
@ -943,7 +893,6 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
} break;
case ScriptLanguage::LookupResult::RESULT_CLASS_METHOD: {
StringName cname = result.class_name;
while (true) {
@ -959,7 +908,6 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
} break;
case ScriptLanguage::LookupResult::RESULT_CLASS_ENUM: {
StringName cname = result.class_name;
StringName success;
while (true) {
@ -1003,7 +951,6 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
}
void ScriptTextEditor::_validate_symbol(const String &p_symbol) {
TextEdit *text_edit = code_editor->get_text_edit();
Node *base = get_tree()->get_edited_scene_root();
@ -1015,7 +962,6 @@ void ScriptTextEditor::_validate_symbol(const String &p_symbol) {
if (ScriptServer::is_global_class(p_symbol) || p_symbol.is_resource_file() || script->get_language()->lookup_code(code_editor->get_text_edit()->get_text_for_lookup_completion(), p_symbol, script->get_path(), base, result) == OK || ProjectSettings::get_singleton()->has_setting("autoload/" + p_symbol)) {
text_edit->set_highlighted_word(p_symbol);
} else if (p_symbol.is_rel_path()) {
String path = _get_absolute_path(p_symbol);
if (FileAccess::exists(path)) {
text_edit->set_highlighted_word(p_symbol);
@ -1124,50 +1070,40 @@ void ScriptTextEditor::_lookup_connections(int p_row, String p_method) {
}
void ScriptTextEditor::_edit_option(int p_op) {
TextEdit *tx = code_editor->get_text_edit();
switch (p_op) {
case EDIT_UNDO: {
tx->undo();
tx->call_deferred("grab_focus");
} break;
case EDIT_REDO: {
tx->redo();
tx->call_deferred("grab_focus");
} break;
case EDIT_CUT: {
tx->cut();
tx->call_deferred("grab_focus");
} break;
case EDIT_COPY: {
tx->copy();
tx->call_deferred("grab_focus");
} break;
case EDIT_PASTE: {
tx->paste();
tx->call_deferred("grab_focus");
} break;
case EDIT_SELECT_ALL: {
tx->select_all();
tx->call_deferred("grab_focus");
} break;
case EDIT_MOVE_LINE_UP: {
code_editor->move_lines_up();
} break;
case EDIT_MOVE_LINE_DOWN: {
code_editor->move_lines_down();
} break;
case EDIT_INDENT_LEFT: {
Ref<Script> scr = script;
if (scr.is_null())
return;
@ -1175,7 +1111,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
tx->indent_left();
} break;
case EDIT_INDENT_RIGHT: {
Ref<Script> scr = script;
if (scr.is_null())
return;
@ -1183,38 +1118,30 @@ void ScriptTextEditor::_edit_option(int p_op) {
tx->indent_right();
} break;
case EDIT_DELETE_LINE: {
code_editor->delete_lines();
} break;
case EDIT_CLONE_DOWN: {
code_editor->clone_lines_down();
} break;
case EDIT_TOGGLE_FOLD_LINE: {
tx->toggle_fold_line(tx->cursor_get_line());
tx->update();
} break;
case EDIT_FOLD_ALL_LINES: {
tx->fold_all_lines();
tx->update();
} break;
case EDIT_UNFOLD_ALL_LINES: {
tx->unhide_all_lines();
tx->update();
} break;
case EDIT_TOGGLE_COMMENT: {
_edit_option_toggle_inline_comment();
} break;
case EDIT_COMPLETE: {
tx->query_code_comple();
} break;
case EDIT_AUTO_INDENT: {
String text = tx->get_text();
Ref<Script> scr = script;
if (scr.is_null())
@ -1242,35 +1169,27 @@ void ScriptTextEditor::_edit_option(int p_op) {
tx->end_complex_operation();
} break;
case EDIT_TRIM_TRAILING_WHITESAPCE: {
trim_trailing_whitespace();
} break;
case EDIT_CONVERT_INDENT_TO_SPACES: {
convert_indent_to_spaces();
} break;
case EDIT_CONVERT_INDENT_TO_TABS: {
convert_indent_to_tabs();
} break;
case EDIT_PICK_COLOR: {
color_panel->popup();
} break;
case EDIT_TO_UPPERCASE: {
_convert_case(CodeTextEditor::UPPER);
} break;
case EDIT_TO_LOWERCASE: {
_convert_case(CodeTextEditor::LOWER);
} break;
case EDIT_CAPITALIZE: {
_convert_case(CodeTextEditor::CAPITALIZE);
} break;
case EDIT_EVALUATE: {
Expression expression;
Vector<String> lines = code_editor->get_text_edit()->get_selection_text().split("\n");
PackedStringArray results;
@ -1296,23 +1215,18 @@ void ScriptTextEditor::_edit_option(int p_op) {
code_editor->get_text_edit()->end_complex_operation();
} break;
case SEARCH_FIND: {
code_editor->get_find_replace_bar()->popup_search();
} break;
case SEARCH_FIND_NEXT: {
code_editor->get_find_replace_bar()->search_next();
} break;
case SEARCH_FIND_PREV: {
code_editor->get_find_replace_bar()->search_prev();
} break;
case SEARCH_REPLACE: {
code_editor->get_find_replace_bar()->popup_replace();
} break;
case SEARCH_IN_FILES: {
String selected_text = code_editor->get_text_edit()->get_selection_text();
// Yep, because it doesn't make sense to instance this dialog for every single script open...
@ -1320,45 +1234,36 @@ void ScriptTextEditor::_edit_option(int p_op) {
emit_signal("search_in_files_requested", selected_text);
} break;
case REPLACE_IN_FILES: {
String selected_text = code_editor->get_text_edit()->get_selection_text();
emit_signal("replace_in_files_requested", selected_text);
} break;
case SEARCH_LOCATE_FUNCTION: {
quick_open->popup_dialog(get_functions());
quick_open->set_title(TTR("Go to Function"));
} break;
case SEARCH_GOTO_LINE: {
goto_line_dialog->popup_find_line(tx);
} break;
case BOOKMARK_TOGGLE: {
code_editor->toggle_bookmark();
} break;
case BOOKMARK_GOTO_NEXT: {
code_editor->goto_next_bookmark();
} break;
case BOOKMARK_GOTO_PREV: {
code_editor->goto_prev_bookmark();
} break;
case BOOKMARK_REMOVE_ALL: {
code_editor->remove_all_bookmarks();
} break;
case DEBUG_TOGGLE_BREAKPOINT: {
int line = tx->cursor_get_line();
bool dobreak = !tx->is_line_set_as_breakpoint(line);
tx->set_line_as_breakpoint(line, dobreak);
EditorDebuggerNode::get_singleton()->set_breakpoint(script->get_path(), line + 1, dobreak);
} break;
case DEBUG_REMOVE_ALL_BREAKPOINTS: {
List<int> bpoints;
tx->get_breakpoints(&bpoints);
@ -1370,7 +1275,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
}
} break;
case DEBUG_GOTO_NEXT_BREAKPOINT: {
List<int> bpoints;
tx->get_breakpoints(&bpoints);
if (bpoints.size() <= 0) {
@ -1398,7 +1302,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
} break;
case DEBUG_GOTO_PREV_BREAKPOINT: {
List<int> bpoints;
tx->get_breakpoints(&bpoints);
if (bpoints.size() <= 0) {
@ -1425,7 +1328,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
} break;
case HELP_CONTEXTUAL: {
String text = tx->get_selection_text();
if (text == "")
text = tx->get_word_under_cursor();
@ -1434,7 +1336,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
}
} break;
case LOOKUP_SYMBOL: {
String text = tx->get_word_under_cursor();
if (text == "")
text = tx->get_selection_text();
@ -1489,7 +1390,6 @@ void ScriptTextEditor::_change_syntax_highlighter(int p_idx) {
}
void ScriptTextEditor::_bind_methods() {
ClassDB::bind_method("_update_connected_methods", &ScriptTextEditor::_update_connected_methods);
ClassDB::bind_method("get_drag_data_fw", &ScriptTextEditor::get_drag_data_fw);
@ -1498,7 +1398,6 @@ void ScriptTextEditor::_bind_methods() {
}
Control *ScriptTextEditor::get_edit_menu() {
return edit_hb;
}
@ -1507,7 +1406,6 @@ void ScriptTextEditor::clear_edit_menu() {
}
void ScriptTextEditor::reload(bool p_soft) {
TextEdit *te = code_editor->get_text_edit();
Ref<Script> scr = script;
if (scr.is_null())
@ -1519,12 +1417,10 @@ void ScriptTextEditor::reload(bool p_soft) {
}
void ScriptTextEditor::get_breakpoints(List<int> *p_breakpoints) {
code_editor->get_text_edit()->get_breakpoints(p_breakpoints);
}
void ScriptTextEditor::set_tooltip_request_func(String p_method, Object *p_obj) {
code_editor->get_text_edit()->set_tooltip_request_func(p_obj, p_method, this);
}
@ -1532,18 +1428,15 @@ void ScriptTextEditor::set_debugger_active(bool p_active) {
}
Variant ScriptTextEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
return Variant();
}
bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
Dictionary d = p_data;
if (d.has("type") && (String(d["type"]) == "resource" ||
String(d["type"]) == "files" ||
String(d["type"]) == "nodes" ||
String(d["type"]) == "files_and_dirs")) {
return true;
}
@ -1551,7 +1444,6 @@ bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_
}
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene)
return nullptr;
@ -1570,7 +1462,6 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
}
void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
Dictionary d = p_data;
TextEdit *te = code_editor->get_text_edit();
@ -1578,7 +1469,6 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
te->_get_mouse_pos(p_point, row, col);
if (d.has("type") && String(d["type"]) == "resource") {
Ref<Resource> res = d["resource"];
if (!res.is_valid()) {
return;
@ -1595,12 +1485,10 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
}
if (d.has("type") && (String(d["type"]) == "files" || String(d["type"]) == "files_and_dirs")) {
Array files = d["files"];
String text_to_drop;
for (int i = 0; i < files.size(); i++) {
if (i > 0)
text_to_drop += ",";
text_to_drop += "\"" + String(files[i]).c_escape() + "\"";
@ -1612,7 +1500,6 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
}
if (d.has("type") && String(d["type"]) == "nodes") {
Node *sn = _find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
if (!sn) {
@ -1623,7 +1510,6 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
Array nodes = d["nodes"];
String text_to_drop;
for (int i = 0; i < nodes.size(); i++) {
if (i > 0)
text_to_drop += ",";
@ -1644,7 +1530,6 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
}
void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
Ref<InputEventMouseButton> mb = ev;
Ref<InputEventKey> k = ev;
Point2 local_pos;
@ -1763,7 +1648,6 @@ void ScriptTextEditor::_color_changed(const Color &p_color) {
}
void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p_foldable, bool p_open_docs, bool p_goto_definition, Vector2 p_pos) {
context_menu->clear();
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);
@ -1805,7 +1689,6 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p
}
ScriptTextEditor::ScriptTextEditor() {
theme_loaded = false;
script_is_valid = false;
@ -1988,7 +1871,6 @@ ScriptTextEditor::~ScriptTextEditor() {
}
static ScriptEditorBase *create_editor(const RES &p_resource) {
if (Object::cast_to<Script>(*p_resource)) {
return memnew(ScriptTextEditor);
}
@ -1996,7 +1878,6 @@ static ScriptEditorBase *create_editor(const RES &p_resource) {
}
void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/undo", TTR("Undo"), KEY_MASK_CMD | KEY_Z);
ED_SHORTCUT("script_text_editor/redo", TTR("Redo"), KEY_MASK_CMD | KEY_Y);
ED_SHORTCUT("script_text_editor/cut", TTR("Cut"), KEY_MASK_CMD | KEY_X);