Cleanup TextEdit selection methods
This commit is contained in:
parent
7e70f9e0b9
commit
9ec3e7f3d7
8 changed files with 516 additions and 485 deletions
|
@ -324,6 +324,13 @@
|
|||
Returns a [String] text with the word under the caret location.
|
||||
</description>
|
||||
</method>
|
||||
<method name="has_selection" qualifiers="const">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Returns [code]true[/code] if the user is has a selection.
|
||||
</description>
|
||||
</method>
|
||||
<method name="insert_text_at_caret">
|
||||
<return type="void">
|
||||
</return>
|
||||
|
@ -384,12 +391,6 @@
|
|||
Returns if the given line is wrapped.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_selection_active" qualifiers="const">
|
||||
<return type="bool" />
|
||||
<description>
|
||||
Returns [code]true[/code] if the selection is active.
|
||||
</description>
|
||||
</method>
|
||||
<method name="menu_option">
|
||||
<return type="void" />
|
||||
<argument index="0" name="option" type="int" />
|
||||
|
@ -469,6 +470,13 @@
|
|||
If [member selecting_enabled] is [code]false[/code], no selection will occur.
|
||||
</description>
|
||||
</method>
|
||||
<method name="select_word_under_caret">
|
||||
<return type="void">
|
||||
</return>
|
||||
<description>
|
||||
Selects the word under the caret.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_caret_column">
|
||||
<return type="void">
|
||||
</return>
|
||||
|
|
|
@ -179,7 +179,7 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col)
|
|||
}
|
||||
|
||||
void FindReplaceBar::_replace() {
|
||||
bool selection_enabled = text_editor->is_selection_active();
|
||||
bool selection_enabled = text_editor->has_selection();
|
||||
Point2i selection_begin, selection_end;
|
||||
if (selection_enabled) {
|
||||
selection_begin = Point2i(text_editor->get_selection_from_line(), text_editor->get_selection_from_column());
|
||||
|
@ -229,7 +229,7 @@ void FindReplaceBar::_replace_all() {
|
|||
Point2i orig_cursor(text_editor->get_caret_line(), text_editor->get_caret_column());
|
||||
Point2i prev_match = Point2(-1, -1);
|
||||
|
||||
bool selection_enabled = text_editor->is_selection_active();
|
||||
bool selection_enabled = text_editor->has_selection();
|
||||
Point2i selection_begin, selection_end;
|
||||
if (selection_enabled) {
|
||||
selection_begin = Point2i(text_editor->get_selection_from_line(), text_editor->get_selection_from_column());
|
||||
|
@ -316,7 +316,7 @@ void FindReplaceBar::_get_search_from(int &r_line, int &r_col) {
|
|||
r_line = text_editor->get_caret_line();
|
||||
r_col = text_editor->get_caret_column();
|
||||
|
||||
if (text_editor->is_selection_active() && is_selection_only()) {
|
||||
if (text_editor->has_selection() && is_selection_only()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ bool FindReplaceBar::search_prev() {
|
|||
|
||||
int line, col;
|
||||
_get_search_from(line, col);
|
||||
if (text_editor->is_selection_active()) {
|
||||
if (text_editor->has_selection()) {
|
||||
col--; // Skip currently selected word.
|
||||
}
|
||||
|
||||
|
@ -487,8 +487,8 @@ void FindReplaceBar::_show_search(bool p_focus_replace, bool p_show_only) {
|
|||
search_text->call_deferred(SNAME("grab_focus"));
|
||||
}
|
||||
|
||||
if (text_editor->is_selection_active() && !selection_only->is_pressed()) {
|
||||
search_text->set_text(text_editor->get_selection_text());
|
||||
if (text_editor->has_selection() && !selection_only->is_pressed()) {
|
||||
search_text->set_text(text_editor->get_selected_text());
|
||||
}
|
||||
|
||||
if (!get_search_text().is_empty()) {
|
||||
|
@ -521,9 +521,9 @@ void FindReplaceBar::popup_replace() {
|
|||
hbc_option_replace->show();
|
||||
}
|
||||
|
||||
selection_only->set_pressed((text_editor->is_selection_active() && text_editor->get_selection_from_line() < text_editor->get_selection_to_line()));
|
||||
selection_only->set_pressed((text_editor->has_selection() && text_editor->get_selection_from_line() < text_editor->get_selection_to_line()));
|
||||
|
||||
_show_search(is_visible() || text_editor->is_selection_active());
|
||||
_show_search(is_visible() || text_editor->has_selection());
|
||||
}
|
||||
|
||||
void FindReplaceBar::_search_options_changed(bool p_pressed) {
|
||||
|
@ -554,7 +554,7 @@ void FindReplaceBar::_search_text_submitted(const String &p_text) {
|
|||
}
|
||||
|
||||
void FindReplaceBar::_replace_text_submitted(const String &p_text) {
|
||||
if (selection_only->is_pressed() && text_editor->is_selection_active()) {
|
||||
if (selection_only->is_pressed() && text_editor->has_selection()) {
|
||||
_replace_all();
|
||||
_hide_bar();
|
||||
} else if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
|
@ -1125,7 +1125,7 @@ void CodeTextEditor::convert_indent_to_tabs() {
|
|||
}
|
||||
|
||||
void CodeTextEditor::convert_case(CaseStyle p_case) {
|
||||
if (!text_editor->is_selection_active()) {
|
||||
if (!text_editor->has_selection()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1171,7 +1171,7 @@ void CodeTextEditor::convert_case(CaseStyle p_case) {
|
|||
|
||||
void CodeTextEditor::move_lines_up() {
|
||||
text_editor->begin_complex_operation();
|
||||
if (text_editor->is_selection_active()) {
|
||||
if (text_editor->has_selection()) {
|
||||
int from_line = text_editor->get_selection_from_line();
|
||||
int from_col = text_editor->get_selection_from_column();
|
||||
int to_line = text_editor->get_selection_to_line();
|
||||
|
@ -1217,7 +1217,7 @@ void CodeTextEditor::move_lines_up() {
|
|||
|
||||
void CodeTextEditor::move_lines_down() {
|
||||
text_editor->begin_complex_operation();
|
||||
if (text_editor->is_selection_active()) {
|
||||
if (text_editor->has_selection()) {
|
||||
int from_line = text_editor->get_selection_from_line();
|
||||
int from_col = text_editor->get_selection_from_column();
|
||||
int to_line = text_editor->get_selection_to_line();
|
||||
|
@ -1276,7 +1276,7 @@ void CodeTextEditor::_delete_line(int p_line) {
|
|||
|
||||
void CodeTextEditor::delete_lines() {
|
||||
text_editor->begin_complex_operation();
|
||||
if (text_editor->is_selection_active()) {
|
||||
if (text_editor->has_selection()) {
|
||||
int to_line = text_editor->get_selection_to_line();
|
||||
int from_line = text_editor->get_selection_from_line();
|
||||
int count = Math::abs(to_line - from_line) + 1;
|
||||
|
@ -1304,7 +1304,7 @@ void CodeTextEditor::duplicate_selection() {
|
|||
bool selection_active = false;
|
||||
|
||||
text_editor->set_caret_column(text_editor->get_line(from_line).length());
|
||||
if (text_editor->is_selection_active()) {
|
||||
if (text_editor->has_selection()) {
|
||||
from_column = text_editor->get_selection_from_column();
|
||||
to_column = text_editor->get_selection_to_column();
|
||||
|
||||
|
@ -1312,7 +1312,7 @@ void CodeTextEditor::duplicate_selection() {
|
|||
to_line = text_editor->get_selection_to_line();
|
||||
cursor_new_line = to_line + text_editor->get_caret_line() - from_line;
|
||||
cursor_new_column = to_column == cursor_column ? 2 * to_column - from_column : to_column;
|
||||
new_text = text_editor->get_selection_text();
|
||||
new_text = text_editor->get_selected_text();
|
||||
selection_active = true;
|
||||
|
||||
text_editor->set_caret_line(to_line);
|
||||
|
@ -1338,7 +1338,7 @@ void CodeTextEditor::duplicate_selection() {
|
|||
|
||||
void CodeTextEditor::toggle_inline_comment(const String &delimiter) {
|
||||
text_editor->begin_complex_operation();
|
||||
if (text_editor->is_selection_active()) {
|
||||
if (text_editor->has_selection()) {
|
||||
int begin = text_editor->get_selection_from_line();
|
||||
int end = text_editor->get_selection_to_line();
|
||||
|
||||
|
@ -1447,8 +1447,8 @@ Variant CodeTextEditor::get_edit_state() {
|
|||
state["column"] = text_editor->get_caret_column();
|
||||
state["row"] = text_editor->get_caret_line();
|
||||
|
||||
state["selection"] = get_text_editor()->is_selection_active();
|
||||
if (get_text_editor()->is_selection_active()) {
|
||||
state["selection"] = get_text_editor()->has_selection();
|
||||
if (get_text_editor()->has_selection()) {
|
||||
state["selection_from_line"] = text_editor->get_selection_from_line();
|
||||
state["selection_from_column"] = text_editor->get_selection_from_column();
|
||||
state["selection_to_line"] = text_editor->get_selection_to_line();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -548,7 +548,7 @@ Control::CursorShape CodeEdit::get_cursor_shape(const Point2 &p_pos) const {
|
|||
|
||||
// Overridable actions
|
||||
void CodeEdit::_handle_unicode_input(const uint32_t p_unicode) {
|
||||
bool had_selection = is_selection_active();
|
||||
bool had_selection = has_selection();
|
||||
if (had_selection) {
|
||||
begin_complex_operation();
|
||||
delete_selection();
|
||||
|
@ -611,7 +611,7 @@ void CodeEdit::_backspace() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (is_selection_active()) {
|
||||
if (has_selection()) {
|
||||
delete_selection();
|
||||
return;
|
||||
}
|
||||
|
@ -718,7 +718,7 @@ void CodeEdit::do_indent() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (is_selection_active()) {
|
||||
if (has_selection()) {
|
||||
indent_lines();
|
||||
return;
|
||||
}
|
||||
|
@ -747,7 +747,7 @@ void CodeEdit::indent_lines() {
|
|||
|
||||
int start_line = get_caret_line();
|
||||
int end_line = start_line;
|
||||
if (is_selection_active()) {
|
||||
if (has_selection()) {
|
||||
start_line = get_selection_from_line();
|
||||
end_line = get_selection_to_line();
|
||||
|
||||
|
@ -760,7 +760,7 @@ void CodeEdit::indent_lines() {
|
|||
|
||||
for (int i = start_line; i <= end_line; i++) {
|
||||
const String line_text = get_line(i);
|
||||
if (line_text.size() == 0 && is_selection_active()) {
|
||||
if (line_text.size() == 0 && has_selection()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -777,7 +777,7 @@ void CodeEdit::indent_lines() {
|
|||
}
|
||||
|
||||
/* Fix selection and caret being off after shifting selection right.*/
|
||||
if (is_selection_active()) {
|
||||
if (has_selection()) {
|
||||
select(start_line, get_selection_from_column() + selection_offset, get_selection_to_line(), get_selection_to_column() + selection_offset);
|
||||
}
|
||||
set_caret_column(get_caret_column() + selection_offset, false);
|
||||
|
@ -792,7 +792,7 @@ void CodeEdit::do_unindent() {
|
|||
|
||||
int cc = get_caret_column();
|
||||
|
||||
if (is_selection_active() || cc <= 0) {
|
||||
if (has_selection() || cc <= 0) {
|
||||
unindent_lines();
|
||||
return;
|
||||
}
|
||||
|
@ -839,7 +839,7 @@ void CodeEdit::unindent_lines() {
|
|||
|
||||
int start_line = get_caret_line();
|
||||
int end_line = start_line;
|
||||
if (is_selection_active()) {
|
||||
if (has_selection()) {
|
||||
start_line = get_selection_from_line();
|
||||
end_line = get_selection_to_line();
|
||||
|
||||
|
@ -882,7 +882,7 @@ void CodeEdit::unindent_lines() {
|
|||
}
|
||||
}
|
||||
|
||||
if (is_selection_active()) {
|
||||
if (has_selection()) {
|
||||
/* Fix selection being off by one on the first line. */
|
||||
if (first_line_edited) {
|
||||
select(get_selection_from_line(), get_selection_from_column() - removed_characters, get_selection_to_line(), initial_selection_end_column);
|
||||
|
@ -1423,7 +1423,7 @@ void CodeEdit::fold_line(int p_line) {
|
|||
}
|
||||
|
||||
/* Fix selection. */
|
||||
if (is_selection_active()) {
|
||||
if (has_selection()) {
|
||||
if (is_line_hidden(get_selection_from_line()) && is_line_hidden(get_selection_to_line())) {
|
||||
deselect();
|
||||
} else if (is_line_hidden(get_selection_from_line())) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -244,6 +244,26 @@ private:
|
|||
bool shiftclick_left = false;
|
||||
} selection;
|
||||
|
||||
bool selecting_enabled = true;
|
||||
|
||||
Color font_selected_color = Color(1, 1, 1);
|
||||
Color selection_color = Color(1, 1, 1);
|
||||
bool override_selected_font_color = false;
|
||||
|
||||
bool dragging_selection = false;
|
||||
|
||||
Timer *click_select_held;
|
||||
uint64_t last_dblclk = 0;
|
||||
Vector2 last_dblclk_pos;
|
||||
void _click_selection_held();
|
||||
|
||||
void _update_selection_mode_pointer();
|
||||
void _update_selection_mode_word();
|
||||
void _update_selection_mode_line();
|
||||
|
||||
void _pre_shift_selection();
|
||||
void _post_shift_selection();
|
||||
|
||||
/* line wrapping. */
|
||||
LineWrappingMode line_wrapping_mode = LineWrappingMode::LINE_WRAPPING_NONE;
|
||||
|
||||
|
@ -317,7 +337,6 @@ private:
|
|||
bool first_draw = true;
|
||||
bool draw_tabs = false;
|
||||
bool draw_spaces = false;
|
||||
bool override_selected_font_color = false;
|
||||
bool text_changed_dirty = false;
|
||||
bool undo_enabled = true;
|
||||
bool hiding_enabled = false;
|
||||
|
@ -331,11 +350,9 @@ private:
|
|||
bool highlight_current_line = false;
|
||||
|
||||
bool insert_mode = false;
|
||||
bool select_identifiers_enabled = false;
|
||||
|
||||
bool smooth_scroll_enabled = false;
|
||||
bool scrolling = false;
|
||||
bool dragging_selection = false;
|
||||
bool dragging_minimap = false;
|
||||
bool can_drag_minimap = false;
|
||||
bool minimap_clicked = false;
|
||||
|
@ -346,11 +363,7 @@ private:
|
|||
|
||||
String lookup_symbol_word;
|
||||
|
||||
uint64_t last_dblclk = 0;
|
||||
Vector2 last_dblclk_pos;
|
||||
|
||||
Timer *idle_detect;
|
||||
Timer *click_select_held;
|
||||
HScrollBar *h_scroll;
|
||||
VScrollBar *v_scroll;
|
||||
bool updating_scrolls = false;
|
||||
|
@ -366,8 +379,6 @@ private:
|
|||
int search_result_line = 0;
|
||||
int search_result_col = 0;
|
||||
|
||||
bool selecting_enabled = true;
|
||||
|
||||
bool context_menu_enabled = true;
|
||||
bool shortcut_keys_enabled = true;
|
||||
bool virtual_keyboard_enabled = true;
|
||||
|
@ -394,20 +405,12 @@ private:
|
|||
void _scroll_moved(double);
|
||||
void _update_scrollbars();
|
||||
void _v_scroll_input();
|
||||
void _click_selection_held();
|
||||
|
||||
void _update_selection_mode_pointer();
|
||||
void _update_selection_mode_word();
|
||||
void _update_selection_mode_line();
|
||||
|
||||
void _update_minimap_click();
|
||||
void _update_minimap_drag();
|
||||
void _scroll_up(real_t p_delta);
|
||||
void _scroll_down(real_t p_delta);
|
||||
|
||||
void _pre_shift_selection();
|
||||
void _post_shift_selection();
|
||||
|
||||
void _scroll_lines_up();
|
||||
void _scroll_lines_down();
|
||||
|
||||
|
@ -470,9 +473,7 @@ protected:
|
|||
int outline_size = 0;
|
||||
Color outline_color;
|
||||
Color font_color;
|
||||
Color font_selected_color;
|
||||
Color font_readonly_color;
|
||||
Color selection_color;
|
||||
Color code_folding_color;
|
||||
Color current_line_color;
|
||||
Color brace_mismatch_color;
|
||||
|
@ -548,6 +549,35 @@ public:
|
|||
|
||||
int get_caret_wrap_index() const;
|
||||
|
||||
/* Selection. */
|
||||
void set_selecting_enabled(const bool p_enabled);
|
||||
bool is_selecting_enabled() const;
|
||||
|
||||
void set_override_selected_font_color(bool p_override_selected_font_color);
|
||||
bool is_overriding_selected_font_color() const;
|
||||
|
||||
void set_selection_mode(SelectionMode p_mode, int p_line = -1, int p_column = -1);
|
||||
SelectionMode get_selection_mode() const;
|
||||
|
||||
void select_all();
|
||||
void select_word_under_caret();
|
||||
void select(int p_from_line, int p_from_column, int p_to_line, int p_to_column);
|
||||
|
||||
bool has_selection() const;
|
||||
|
||||
String get_selected_text() const;
|
||||
|
||||
int get_selection_line() const;
|
||||
int get_selection_column() const;
|
||||
|
||||
int get_selection_from_line() const;
|
||||
int get_selection_from_column() const;
|
||||
int get_selection_to_line() const;
|
||||
int get_selection_to_column() const;
|
||||
|
||||
void deselect();
|
||||
void delete_selection();
|
||||
|
||||
/* line wrapping. */
|
||||
void set_line_wrapping_mode(LineWrappingMode p_wrapping_mode);
|
||||
LineWrappingMode get_line_wrapping_mode() const;
|
||||
|
@ -710,22 +740,11 @@ public:
|
|||
void adjust_viewport_to_caret();
|
||||
void center_viewport_to_caret();
|
||||
|
||||
SelectionMode get_selection_mode() const;
|
||||
void set_selection_mode(SelectionMode p_mode, int p_line = -1, int p_column = -1);
|
||||
int get_selection_line() const;
|
||||
int get_selection_column() const;
|
||||
|
||||
void set_readonly(bool p_readonly);
|
||||
bool is_readonly() const;
|
||||
|
||||
void clear();
|
||||
|
||||
void delete_selection();
|
||||
|
||||
void select_all();
|
||||
void select_word_under_caret();
|
||||
void select(int p_from_line, int p_from_column, int p_to_line, int p_to_column);
|
||||
void deselect();
|
||||
void swap_lines(int line1, int line2);
|
||||
|
||||
void set_search_text(const String &p_search_text);
|
||||
|
@ -734,12 +753,6 @@ public:
|
|||
|
||||
void set_highlight_all_occurrences(const bool p_enabled);
|
||||
bool is_highlight_all_occurrences_enabled() const;
|
||||
bool is_selection_active() const;
|
||||
int get_selection_from_line() const;
|
||||
int get_selection_from_column() const;
|
||||
int get_selection_to_line() const;
|
||||
int get_selection_to_column() const;
|
||||
String get_selection_text() const;
|
||||
|
||||
String get_word_under_caret() const;
|
||||
String get_word_at_pos(const Vector2 &p_pos) const;
|
||||
|
@ -756,8 +769,6 @@ public:
|
|||
bool is_drawing_tabs() const;
|
||||
void set_draw_spaces(bool p_draw);
|
||||
bool is_drawing_spaces() const;
|
||||
void set_override_selected_font_color(bool p_override_selected_font_color);
|
||||
bool is_overriding_selected_font_color() const;
|
||||
|
||||
void set_insert_mode(bool p_enabled);
|
||||
bool is_insert_mode() const;
|
||||
|
@ -797,9 +808,6 @@ public:
|
|||
void set_context_menu_enabled(bool p_enable);
|
||||
bool is_context_menu_enabled();
|
||||
|
||||
void set_selecting_enabled(bool p_enabled);
|
||||
bool is_selecting_enabled() const;
|
||||
|
||||
void set_shortcut_keys_enabled(bool p_enabled);
|
||||
bool is_shortcut_keys_enabled() const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue