aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/plugins/script_editor_plugin.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2014-05-24 01:35:47 -0300
committerJuan Linietsky2014-05-24 01:35:47 -0300
commit1cad087969efefa401a11051343cd0689f660770 (patch)
tree1595dd049bdb7289752012dca4398b2251fb08fa /tools/editor/plugins/script_editor_plugin.cpp
parentf9ff086235cd4ff406b136f62fff77b85c0873f9 (diff)
downloadgodot-1cad087969efefa401a11051343cd0689f660770.tar.gz
godot-1cad087969efefa401a11051343cd0689f660770.tar.zst
godot-1cad087969efefa401a11051343cd0689f660770.zip
Making Godot Easier to Use..
-=-=-=-=-=-=-=-=-=-=-=-=-=-= -Auto indenter in code editor, this makes it much easier to paste external code. -Zoom in 2D viewport now uses the mouse pointer as reference. -Obscure hack to see where code/line of GDScript in C++ backtrace. -Fixed a bug where keys would get stuck on X11 if pressed simultaneously -Added Api on IP singleton to request local IPs. -Premultiplied alpha support when importing texture, editing PNGs and as a blend mode.
Diffstat (limited to 'tools/editor/plugins/script_editor_plugin.cpp')
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 83cf75369..31ccc79d2 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -688,6 +688,26 @@ void ScriptEditor::_menu_option(int p_option) {
current->get_text_edit()->query_code_comple();
} break;
+ case EDIT_AUTO_INDENT: {
+
+ TextEdit *te = current->get_text_edit();
+ String text = te->get_text();
+ Ref<Script> scr = current->get_edited_script();
+ if (scr.is_null())
+ return;
+ int begin,end;
+ if (te->is_selection_active()) {
+ begin=te->get_selection_from_line();
+ end=te->get_selection_to_line();
+ } else {
+ begin=0;
+ end=te->get_line_count()-1;
+ }
+ scr->get_language()->auto_indent_code(text,begin,end);
+ te->set_text(text);
+
+
+ } break;
case SEARCH_FIND: {
find_replace_dialog->set_text_edit(current->get_text_edit());
@@ -1321,6 +1341,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
edit_menu->get_popup()->add_item("Select All",EDIT_SELECT_ALL,KEY_MASK_CMD|KEY_A);
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_item("Complete Symbol",EDIT_COMPLETE,KEY_MASK_CMD|KEY_SPACE);
+ edit_menu->get_popup()->add_item("Auto Indent",EDIT_AUTO_INDENT,KEY_MASK_CMD|KEY_I);
edit_menu->get_popup()->connect("item_pressed", this,"_menu_option");