summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorPaulb23 <p_batty@hotmail.co.uk>2021-07-09 12:42:55 +0100
committerPaulb23 <p_batty@hotmail.co.uk>2021-08-12 09:29:56 +0100
commit9ec3e7f3d7ae7f9eaf5a1de29346c5e10b3af6f9 (patch)
tree2953e06268871695e0c49b12f16372ce672bf027 /editor/plugins
parent7e70f9e0b9696fab55e2d0570c6bdc8b07c14462 (diff)
Cleanup TextEdit selection methods
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/script_text_editor.cpp20
-rw-r--r--editor/plugins/shader_editor_plugin.cpp8
-rw-r--r--editor/plugins/text_editor.cpp12
3 files changed, 20 insertions, 20 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 2faa56e661..ad25bca9da 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1080,7 +1080,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
tx->begin_complex_operation();
int begin, end;
- if (tx->is_selection_active()) {
+ if (tx->has_selection()) {
begin = tx->get_selection_from_line();
end = tx->get_selection_to_line();
// ignore if the cursor is not past the first column
@@ -1122,7 +1122,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
} break;
case EDIT_EVALUATE: {
Expression expression;
- Vector<String> lines = code_editor->get_text_editor()->get_selection_text().split("\n");
+ Vector<String> lines = code_editor->get_text_editor()->get_selected_text().split("\n");
PackedStringArray results;
for (int i = 0; i < lines.size(); i++) {
@@ -1158,14 +1158,14 @@ void ScriptTextEditor::_edit_option(int p_op) {
code_editor->get_find_replace_bar()->popup_replace();
} break;
case SEARCH_IN_FILES: {
- String selected_text = code_editor->get_text_editor()->get_selection_text();
+ String selected_text = code_editor->get_text_editor()->get_selected_text();
// Yep, because it doesn't make sense to instance this dialog for every single script open...
// So this will be delegated to the ScriptEditor.
emit_signal(SNAME("search_in_files_requested"), selected_text);
} break;
case REPLACE_IN_FILES: {
- String selected_text = code_editor->get_text_editor()->get_selection_text();
+ String selected_text = code_editor->get_text_editor()->get_selected_text();
emit_signal(SNAME("replace_in_files_requested"), selected_text);
} break;
@@ -1256,7 +1256,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
} break;
case HELP_CONTEXTUAL: {
- String text = tx->get_selection_text();
+ String text = tx->get_selected_text();
if (text == "") {
text = tx->get_word_under_caret();
}
@@ -1267,7 +1267,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
case LOOKUP_SYMBOL: {
String text = tx->get_word_under_caret();
if (text == "") {
- text = tx->get_selection_text();
+ text = tx->get_selected_text();
}
if (text != "") {
_lookup_symbol(text, tx->get_caret_line(), tx->get_caret_column());
@@ -1517,7 +1517,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
tx->set_move_caret_on_right_click_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/right_click_moves_caret"));
if (tx->is_move_caret_on_right_click_enabled()) {
- if (tx->is_selection_active()) {
+ if (tx->has_selection()) {
int from_line = tx->get_selection_from_line();
int to_line = tx->get_selection_to_line();
int from_column = tx->get_selection_from_column();
@@ -1528,7 +1528,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
tx->deselect();
}
}
- if (!tx->is_selection_active()) {
+ if (!tx->has_selection()) {
tx->set_caret_line(row, false, false);
tx->set_caret_column(col);
}
@@ -1539,7 +1539,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
word_at_pos = tx->get_word_under_caret();
}
if (word_at_pos == "") {
- word_at_pos = tx->get_selection_text();
+ word_at_pos = tx->get_selected_text();
}
bool has_color = (word_at_pos == "Color");
@@ -1591,7 +1591,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
has_color = false;
}
}
- _make_context_menu(tx->is_selection_active(), has_color, foldable, open_docs, goto_definition, local_pos);
+ _make_context_menu(tx->has_selection(), has_color, foldable, open_docs, goto_definition, local_pos);
}
}
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 3190a0d8ef..00890227cb 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -556,7 +556,7 @@ void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
tx->set_move_caret_on_right_click_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/right_click_moves_caret"));
if (tx->is_move_caret_on_right_click_enabled()) {
- if (tx->is_selection_active()) {
+ if (tx->has_selection()) {
int from_line = tx->get_selection_from_line();
int to_line = tx->get_selection_to_line();
int from_column = tx->get_selection_from_column();
@@ -567,12 +567,12 @@ void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
tx->deselect();
}
}
- if (!tx->is_selection_active()) {
+ if (!tx->has_selection()) {
tx->set_caret_line(row, true, false);
tx->set_caret_column(col);
}
}
- _make_context_menu(tx->is_selection_active(), get_local_mouse_position());
+ _make_context_menu(tx->has_selection(), get_local_mouse_position());
}
}
@@ -580,7 +580,7 @@ void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
if (k.is_valid() && k->is_pressed() && k->is_action("ui_menu", true)) {
CodeEdit *tx = shader_editor->get_text_editor();
tx->adjust_viewport_to_caret();
- _make_context_menu(tx->is_selection_active(), (get_global_transform().inverse() * tx->get_global_transform()).xform(tx->get_caret_draw_pos()));
+ _make_context_menu(tx->has_selection(), (get_global_transform().inverse() * tx->get_global_transform()).xform(tx->get_caret_draw_pos()));
context_menu->grab_focus();
}
}
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 6eea8ae227..4e90399433 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -374,14 +374,14 @@ void TextEditor::_edit_option(int p_op) {
code_editor->get_find_replace_bar()->popup_replace();
} break;
case SEARCH_IN_FILES: {
- String selected_text = code_editor->get_text_editor()->get_selection_text();
+ String selected_text = code_editor->get_text_editor()->get_selected_text();
// Yep, because it doesn't make sense to instance this dialog for every single script open...
// So this will be delegated to the ScriptEditor.
emit_signal(SNAME("search_in_files_requested"), selected_text);
} break;
case REPLACE_IN_FILES: {
- String selected_text = code_editor->get_text_editor()->get_selection_text();
+ String selected_text = code_editor->get_text_editor()->get_selected_text();
emit_signal(SNAME("replace_in_files_requested"), selected_text);
} break;
@@ -436,7 +436,7 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
bool is_folded = tx->is_line_folded(row);
if (tx->is_move_caret_on_right_click_enabled()) {
- if (tx->is_selection_active()) {
+ if (tx->has_selection()) {
int from_line = tx->get_selection_from_line();
int to_line = tx->get_selection_to_line();
int from_column = tx->get_selection_from_column();
@@ -447,14 +447,14 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
tx->deselect();
}
}
- if (!tx->is_selection_active()) {
+ if (!tx->has_selection()) {
tx->set_caret_line(row, true, false);
tx->set_caret_column(col);
}
}
if (!mb->is_pressed()) {
- _make_context_menu(tx->is_selection_active(), can_fold, is_folded, get_local_mouse_position());
+ _make_context_menu(tx->has_selection(), can_fold, is_folded, get_local_mouse_position());
}
}
}
@@ -464,7 +464,7 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
CodeEdit *tx = code_editor->get_text_editor();
int line = tx->get_caret_line();
tx->adjust_viewport_to_caret();
- _make_context_menu(tx->is_selection_active(), tx->can_fold_line(line), tx->is_line_folded(line), (get_global_transform().inverse() * tx->get_global_transform()).xform(tx->get_caret_draw_pos()));
+ _make_context_menu(tx->has_selection(), tx->can_fold_line(line), tx->is_line_folded(line), (get_global_transform().inverse() * tx->get_global_transform()).xform(tx->get_caret_draw_pos()));
context_menu->grab_focus();
}
}