diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 21 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/project_manager.cpp | 2 |
3 files changed, 17 insertions, 8 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 214f24b386..19293360ed 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1039,6 +1039,13 @@ void ScriptTextEditor::_edit_option(int p_op) { if (scr.is_null()) return; + String delimiter = "#"; + List<String> comment_delimiters; + scr->get_language()->get_comment_delimiters(&comment_delimiters); + if (!comment_delimiters.empty()) { + delimiter = comment_delimiters.front()->get(); + } + tx->begin_complex_operation(); if (tx->is_selection_active()) { int begin = tx->get_selection_from_line(); @@ -1051,7 +1058,7 @@ void ScriptTextEditor::_edit_option(int p_op) { // Check if all lines in the selected block are commented bool is_commented = true; for (int i = begin; i <= end; i++) { - if (!tx->get_line(i).begins_with("#")) { + if (!tx->get_line(i).begins_with(delimiter)) { is_commented = false; break; } @@ -1060,12 +1067,12 @@ void ScriptTextEditor::_edit_option(int p_op) { String line_text = tx->get_line(i); if (line_text.strip_edges().empty()) { - line_text = "#"; + line_text = delimiter; } else { if (is_commented) { - line_text = line_text.substr(1, line_text.length()); + line_text = line_text.substr(delimiter.length(), line_text.length()); } else { - line_text = "#" + line_text; + line_text = delimiter + line_text; } } tx->set_line(i, line_text); @@ -1074,10 +1081,10 @@ void ScriptTextEditor::_edit_option(int p_op) { int begin = tx->cursor_get_line(); String line_text = tx->get_line(begin); - if (line_text.begins_with("#")) - line_text = line_text.substr(1, line_text.length()); + if (line_text.begins_with(delimiter)) + line_text = line_text.substr(delimiter.length(), line_text.length()); else - line_text = "#" + line_text; + line_text = delimiter + line_text; tx->set_line(begin, line_text); } tx->end_complex_operation(); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 9fd41c1064..390cbf727c 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -3389,6 +3389,8 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed preview_camera->set_toggle_mode(true); preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE); preview_camera->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE); + preview_camera->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -10 * EDSCALE); + preview_camera->set_h_grow_direction(GROW_DIRECTION_BEGIN); preview_camera->set_text(TTR("preview")); surface->add_child(preview_camera); preview_camera->hide(); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 43c7f33cbe..60d7e59991 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -213,7 +213,7 @@ private: } String sp = p.simplify_path(); project_path->set_text(sp); - set_message(TTR(" ")); // just so it does not disappear + set_message(" "); // just so it does not disappear get_ok()->call_deferred("grab_focus"); } |