|
@@ -44,7 +44,7 @@
|
|
|
void GotoLineDialog::popup_find_line(CodeEdit *p_edit) {
|
|
|
text_editor = p_edit;
|
|
|
|
|
|
- line->set_text(itos(text_editor->cursor_get_line()));
|
|
|
+ line->set_text(itos(text_editor->get_caret_line()));
|
|
|
line->select_all();
|
|
|
popup_centered(Size2(180, 80) * EDSCALE);
|
|
|
line->grab_focus();
|
|
@@ -59,7 +59,7 @@ void GotoLineDialog::ok_pressed() {
|
|
|
return;
|
|
|
}
|
|
|
text_editor->unfold_line(get_line() - 1);
|
|
|
- text_editor->cursor_set_line(get_line() - 1);
|
|
|
+ text_editor->set_caret_line(get_line() - 1);
|
|
|
hide();
|
|
|
}
|
|
|
|
|
@@ -150,9 +150,9 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col)
|
|
|
if (found) {
|
|
|
if (!preserve_cursor && !is_selection_only()) {
|
|
|
text_editor->unfold_line(line);
|
|
|
- text_editor->cursor_set_line(line, false);
|
|
|
- text_editor->cursor_set_column(col + text.length(), false);
|
|
|
- text_editor->center_viewport_to_cursor();
|
|
|
+ text_editor->set_caret_line(line, false);
|
|
|
+ text_editor->set_caret_column(col + text.length(), false);
|
|
|
+ text_editor->center_viewport_to_caret();
|
|
|
text_editor->select(line, col, line, col + text.length());
|
|
|
}
|
|
|
|
|
@@ -191,8 +191,8 @@ void FindReplaceBar::_replace() {
|
|
|
|
|
|
text_editor->begin_complex_operation();
|
|
|
if (selection_enabled && is_selection_only()) { // To restrict search_current() to selected region
|
|
|
- text_editor->cursor_set_line(selection_begin.width);
|
|
|
- text_editor->cursor_set_column(selection_begin.height);
|
|
|
+ text_editor->set_caret_line(selection_begin.width);
|
|
|
+ text_editor->set_caret_column(selection_begin.height);
|
|
|
}
|
|
|
|
|
|
if (search_current()) {
|
|
@@ -203,13 +203,13 @@ void FindReplaceBar::_replace() {
|
|
|
Point2i match_from(result_line, result_col);
|
|
|
Point2i match_to(result_line, result_col + search_text_len);
|
|
|
if (!(match_from < selection_begin || match_to > selection_end)) {
|
|
|
- text_editor->insert_text_at_cursor(replace_text);
|
|
|
+ text_editor->insert_text_at_caret(replace_text);
|
|
|
if (match_to.x == selection_end.x) { // Adjust selection bounds if necessary
|
|
|
selection_end.y += replace_text.length() - search_text_len;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- text_editor->insert_text_at_cursor(replace_text);
|
|
|
+ text_editor->insert_text_at_caret(replace_text);
|
|
|
}
|
|
|
}
|
|
|
text_editor->end_complex_operation();
|
|
@@ -226,7 +226,7 @@ void FindReplaceBar::_replace() {
|
|
|
void FindReplaceBar::_replace_all() {
|
|
|
text_editor->disconnect("text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed));
|
|
|
// Line as x so it gets priority in comparison, column as y.
|
|
|
- Point2i orig_cursor(text_editor->cursor_get_line(), text_editor->cursor_get_column());
|
|
|
+ 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();
|
|
@@ -238,8 +238,8 @@ void FindReplaceBar::_replace_all() {
|
|
|
|
|
|
int vsval = text_editor->get_v_scroll();
|
|
|
|
|
|
- text_editor->cursor_set_line(0);
|
|
|
- text_editor->cursor_set_column(0);
|
|
|
+ text_editor->set_caret_line(0);
|
|
|
+ text_editor->set_caret_column(0);
|
|
|
|
|
|
String replace_text = get_replace_text();
|
|
|
int search_text_len = get_search_text().length();
|
|
@@ -251,8 +251,8 @@ void FindReplaceBar::_replace_all() {
|
|
|
text_editor->begin_complex_operation();
|
|
|
|
|
|
if (selection_enabled && is_selection_only()) {
|
|
|
- text_editor->cursor_set_line(selection_begin.width);
|
|
|
- text_editor->cursor_set_column(selection_begin.height);
|
|
|
+ text_editor->set_caret_line(selection_begin.width);
|
|
|
+ text_editor->set_caret_column(selection_begin.height);
|
|
|
}
|
|
|
if (search_current()) {
|
|
|
do {
|
|
@@ -275,14 +275,14 @@ void FindReplaceBar::_replace_all() {
|
|
|
}
|
|
|
|
|
|
// Replace but adjust selection bounds.
|
|
|
- text_editor->insert_text_at_cursor(replace_text);
|
|
|
+ text_editor->insert_text_at_caret(replace_text);
|
|
|
if (match_to.x == selection_end.x) {
|
|
|
selection_end.y += replace_text.length() - search_text_len;
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
// Just replace.
|
|
|
- text_editor->insert_text_at_cursor(replace_text);
|
|
|
+ text_editor->insert_text_at_caret(replace_text);
|
|
|
}
|
|
|
|
|
|
rc++;
|
|
@@ -294,8 +294,8 @@ void FindReplaceBar::_replace_all() {
|
|
|
replace_all_mode = false;
|
|
|
|
|
|
// Restore editor state (selection, cursor, scroll).
|
|
|
- text_editor->cursor_set_line(orig_cursor.x);
|
|
|
- text_editor->cursor_set_column(orig_cursor.y);
|
|
|
+ text_editor->set_caret_line(orig_cursor.x);
|
|
|
+ text_editor->set_caret_column(orig_cursor.y);
|
|
|
|
|
|
if (selection_enabled && is_selection_only()) {
|
|
|
// Reselect.
|
|
@@ -313,8 +313,8 @@ void FindReplaceBar::_replace_all() {
|
|
|
}
|
|
|
|
|
|
void FindReplaceBar::_get_search_from(int &r_line, int &r_col) {
|
|
|
- r_line = text_editor->cursor_get_line();
|
|
|
- r_col = text_editor->cursor_get_column();
|
|
|
+ r_line = text_editor->get_caret_line();
|
|
|
+ r_col = text_editor->get_caret_column();
|
|
|
|
|
|
if (text_editor->is_selection_active() && is_selection_only()) {
|
|
|
return;
|
|
@@ -807,10 +807,10 @@ void CodeTextEditor::_reset_zoom() {
|
|
|
}
|
|
|
|
|
|
void CodeTextEditor::_line_col_changed() {
|
|
|
- String line = text_editor->get_line(text_editor->cursor_get_line());
|
|
|
+ String line = text_editor->get_line(text_editor->get_caret_line());
|
|
|
|
|
|
int positional_column = 0;
|
|
|
- for (int i = 0; i < text_editor->cursor_get_column(); i++) {
|
|
|
+ for (int i = 0; i < text_editor->get_caret_column(); i++) {
|
|
|
if (line[i] == '\t') {
|
|
|
positional_column += text_editor->get_indent_size(); //tab size
|
|
|
} else {
|
|
@@ -820,7 +820,7 @@ void CodeTextEditor::_line_col_changed() {
|
|
|
|
|
|
StringBuilder sb;
|
|
|
sb.append("(");
|
|
|
- sb.append(itos(text_editor->cursor_get_line() + 1).lpad(3));
|
|
|
+ sb.append(itos(text_editor->get_caret_line() + 1).lpad(3));
|
|
|
sb.append(",");
|
|
|
sb.append(itos(positional_column + 1).lpad(3));
|
|
|
sb.append(")");
|
|
@@ -952,9 +952,9 @@ void CodeTextEditor::update_editor_settings() {
|
|
|
text_editor->set_draw_fold_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/code_folding"));
|
|
|
text_editor->set_wrap_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/word_wrap"));
|
|
|
text_editor->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file"));
|
|
|
- text_editor->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret"));
|
|
|
- text_editor->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink"));
|
|
|
- text_editor->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed"));
|
|
|
+ text_editor->set_caret_type((TextEdit::CaretType)EditorSettings::get_singleton()->get("text_editor/cursor/type").operator int());
|
|
|
+ text_editor->set_caret_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink"));
|
|
|
+ text_editor->set_caret_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed"));
|
|
|
text_editor->set_auto_brace_completion_enabled(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete"));
|
|
|
|
|
|
if (EditorSettings::get_singleton()->get("text_editor/appearance/show_line_length_guidelines")) {
|
|
@@ -1039,8 +1039,8 @@ void CodeTextEditor::convert_indent_to_spaces() {
|
|
|
indent += " ";
|
|
|
}
|
|
|
|
|
|
- int cursor_line = text_editor->cursor_get_line();
|
|
|
- int cursor_column = text_editor->cursor_get_column();
|
|
|
+ int cursor_line = text_editor->get_caret_line();
|
|
|
+ int cursor_column = text_editor->get_caret_column();
|
|
|
|
|
|
bool changed_indentation = false;
|
|
|
for (int i = 0; i < text_editor->get_line_count(); i++) {
|
|
@@ -1069,7 +1069,7 @@ void CodeTextEditor::convert_indent_to_spaces() {
|
|
|
}
|
|
|
}
|
|
|
if (changed_indentation) {
|
|
|
- text_editor->cursor_set_column(cursor_column);
|
|
|
+ text_editor->set_caret_column(cursor_column);
|
|
|
text_editor->end_complex_operation();
|
|
|
text_editor->update();
|
|
|
}
|
|
@@ -1079,8 +1079,8 @@ void CodeTextEditor::convert_indent_to_tabs() {
|
|
|
int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size");
|
|
|
indent_size -= 1;
|
|
|
|
|
|
- int cursor_line = text_editor->cursor_get_line();
|
|
|
- int cursor_column = text_editor->cursor_get_column();
|
|
|
+ int cursor_line = text_editor->get_caret_line();
|
|
|
+ int cursor_column = text_editor->get_caret_column();
|
|
|
|
|
|
bool changed_indentation = false;
|
|
|
for (int i = 0; i < text_editor->get_line_count(); i++) {
|
|
@@ -1118,7 +1118,7 @@ void CodeTextEditor::convert_indent_to_tabs() {
|
|
|
}
|
|
|
}
|
|
|
if (changed_indentation) {
|
|
|
- text_editor->cursor_set_column(cursor_column);
|
|
|
+ text_editor->set_caret_column(cursor_column);
|
|
|
text_editor->end_complex_operation();
|
|
|
text_editor->update();
|
|
|
}
|
|
@@ -1176,7 +1176,7 @@ void CodeTextEditor::move_lines_up() {
|
|
|
int from_col = text_editor->get_selection_from_column();
|
|
|
int to_line = text_editor->get_selection_to_line();
|
|
|
int to_column = text_editor->get_selection_to_column();
|
|
|
- int cursor_line = text_editor->cursor_get_line();
|
|
|
+ int cursor_line = text_editor->get_caret_line();
|
|
|
|
|
|
for (int i = from_line; i <= to_line; i++) {
|
|
|
int line_id = i;
|
|
@@ -1190,15 +1190,15 @@ void CodeTextEditor::move_lines_up() {
|
|
|
text_editor->unfold_line(next_id);
|
|
|
|
|
|
text_editor->swap_lines(line_id, next_id);
|
|
|
- text_editor->cursor_set_line(next_id);
|
|
|
+ text_editor->set_caret_line(next_id);
|
|
|
}
|
|
|
int from_line_up = from_line > 0 ? from_line - 1 : from_line;
|
|
|
int to_line_up = to_line > 0 ? to_line - 1 : to_line;
|
|
|
int cursor_line_up = cursor_line > 0 ? cursor_line - 1 : cursor_line;
|
|
|
text_editor->select(from_line_up, from_col, to_line_up, to_column);
|
|
|
- text_editor->cursor_set_line(cursor_line_up);
|
|
|
+ text_editor->set_caret_line(cursor_line_up);
|
|
|
} else {
|
|
|
- int line_id = text_editor->cursor_get_line();
|
|
|
+ int line_id = text_editor->get_caret_line();
|
|
|
int next_id = line_id - 1;
|
|
|
|
|
|
if (line_id == 0 || next_id < 0) {
|
|
@@ -1209,7 +1209,7 @@ void CodeTextEditor::move_lines_up() {
|
|
|
text_editor->unfold_line(next_id);
|
|
|
|
|
|
text_editor->swap_lines(line_id, next_id);
|
|
|
- text_editor->cursor_set_line(next_id);
|
|
|
+ text_editor->set_caret_line(next_id);
|
|
|
}
|
|
|
text_editor->end_complex_operation();
|
|
|
text_editor->update();
|
|
@@ -1222,7 +1222,7 @@ void CodeTextEditor::move_lines_down() {
|
|
|
int from_col = text_editor->get_selection_from_column();
|
|
|
int to_line = text_editor->get_selection_to_line();
|
|
|
int to_column = text_editor->get_selection_to_column();
|
|
|
- int cursor_line = text_editor->cursor_get_line();
|
|
|
+ int cursor_line = text_editor->get_caret_line();
|
|
|
|
|
|
for (int i = to_line; i >= from_line; i--) {
|
|
|
int line_id = i;
|
|
@@ -1236,15 +1236,15 @@ void CodeTextEditor::move_lines_down() {
|
|
|
text_editor->unfold_line(next_id);
|
|
|
|
|
|
text_editor->swap_lines(line_id, next_id);
|
|
|
- text_editor->cursor_set_line(next_id);
|
|
|
+ text_editor->set_caret_line(next_id);
|
|
|
}
|
|
|
int from_line_down = from_line < text_editor->get_line_count() ? from_line + 1 : from_line;
|
|
|
int to_line_down = to_line < text_editor->get_line_count() ? to_line + 1 : to_line;
|
|
|
int cursor_line_down = cursor_line < text_editor->get_line_count() ? cursor_line + 1 : cursor_line;
|
|
|
text_editor->select(from_line_down, from_col, to_line_down, to_column);
|
|
|
- text_editor->cursor_set_line(cursor_line_down);
|
|
|
+ text_editor->set_caret_line(cursor_line_down);
|
|
|
} else {
|
|
|
- int line_id = text_editor->cursor_get_line();
|
|
|
+ int line_id = text_editor->get_caret_line();
|
|
|
int next_id = line_id + 1;
|
|
|
|
|
|
if (line_id == text_editor->get_line_count() - 1 || next_id > text_editor->get_line_count()) {
|
|
@@ -1255,7 +1255,7 @@ void CodeTextEditor::move_lines_down() {
|
|
|
text_editor->unfold_line(next_id);
|
|
|
|
|
|
text_editor->swap_lines(line_id, next_id);
|
|
|
- text_editor->cursor_set_line(next_id);
|
|
|
+ text_editor->set_caret_line(next_id);
|
|
|
}
|
|
|
text_editor->end_complex_operation();
|
|
|
text_editor->update();
|
|
@@ -1266,12 +1266,12 @@ void CodeTextEditor::_delete_line(int p_line) {
|
|
|
// so `begin_complex_operation` is omitted here
|
|
|
text_editor->set_line(p_line, "");
|
|
|
if (p_line == 0 && text_editor->get_line_count() > 1) {
|
|
|
- text_editor->cursor_set_line(1);
|
|
|
- text_editor->cursor_set_column(0);
|
|
|
+ text_editor->set_caret_line(1);
|
|
|
+ text_editor->set_caret_column(0);
|
|
|
}
|
|
|
text_editor->backspace();
|
|
|
text_editor->unfold_line(p_line);
|
|
|
- text_editor->cursor_set_line(p_line);
|
|
|
+ text_editor->set_caret_line(p_line);
|
|
|
}
|
|
|
|
|
|
void CodeTextEditor::delete_lines() {
|
|
@@ -1281,42 +1281,42 @@ void CodeTextEditor::delete_lines() {
|
|
|
int from_line = text_editor->get_selection_from_line();
|
|
|
int count = Math::abs(to_line - from_line) + 1;
|
|
|
|
|
|
- text_editor->cursor_set_line(from_line, false);
|
|
|
+ text_editor->set_caret_line(from_line, false);
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
_delete_line(from_line);
|
|
|
}
|
|
|
text_editor->deselect();
|
|
|
} else {
|
|
|
- _delete_line(text_editor->cursor_get_line());
|
|
|
+ _delete_line(text_editor->get_caret_line());
|
|
|
}
|
|
|
text_editor->end_complex_operation();
|
|
|
}
|
|
|
|
|
|
void CodeTextEditor::duplicate_selection() {
|
|
|
- const int cursor_column = text_editor->cursor_get_column();
|
|
|
- int from_line = text_editor->cursor_get_line();
|
|
|
- int to_line = text_editor->cursor_get_line();
|
|
|
+ const int cursor_column = text_editor->get_caret_column();
|
|
|
+ int from_line = text_editor->get_caret_line();
|
|
|
+ int to_line = text_editor->get_caret_line();
|
|
|
int from_column = 0;
|
|
|
int to_column = 0;
|
|
|
int cursor_new_line = to_line + 1;
|
|
|
- int cursor_new_column = text_editor->cursor_get_column();
|
|
|
+ int cursor_new_column = text_editor->get_caret_column();
|
|
|
String new_text = "\n" + text_editor->get_line(from_line);
|
|
|
bool selection_active = false;
|
|
|
|
|
|
- text_editor->cursor_set_column(text_editor->get_line(from_line).length());
|
|
|
+ text_editor->set_caret_column(text_editor->get_line(from_line).length());
|
|
|
if (text_editor->is_selection_active()) {
|
|
|
from_column = text_editor->get_selection_from_column();
|
|
|
to_column = text_editor->get_selection_to_column();
|
|
|
|
|
|
from_line = text_editor->get_selection_from_line();
|
|
|
to_line = text_editor->get_selection_to_line();
|
|
|
- cursor_new_line = to_line + text_editor->cursor_get_line() - from_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();
|
|
|
selection_active = true;
|
|
|
|
|
|
- text_editor->cursor_set_line(to_line);
|
|
|
- text_editor->cursor_set_column(to_column);
|
|
|
+ text_editor->set_caret_line(to_line);
|
|
|
+ text_editor->set_caret_column(to_column);
|
|
|
}
|
|
|
|
|
|
text_editor->begin_complex_operation();
|
|
@@ -1325,9 +1325,9 @@ void CodeTextEditor::duplicate_selection() {
|
|
|
text_editor->unfold_line(i);
|
|
|
}
|
|
|
text_editor->deselect();
|
|
|
- text_editor->insert_text_at_cursor(new_text);
|
|
|
- text_editor->cursor_set_line(cursor_new_line);
|
|
|
- text_editor->cursor_set_column(cursor_new_column);
|
|
|
+ text_editor->insert_text_at_caret(new_text);
|
|
|
+ text_editor->set_caret_line(cursor_new_line);
|
|
|
+ text_editor->set_caret_column(cursor_new_column);
|
|
|
if (selection_active) {
|
|
|
text_editor->select(to_line, to_column, 2 * to_line - from_line, to_line == from_line ? 2 * to_column - from_column : to_column);
|
|
|
}
|
|
@@ -1348,7 +1348,7 @@ void CodeTextEditor::toggle_inline_comment(const String &delimiter) {
|
|
|
}
|
|
|
|
|
|
int col_to = text_editor->get_selection_to_column();
|
|
|
- int cursor_pos = text_editor->cursor_get_column();
|
|
|
+ int cursor_pos = text_editor->get_caret_column();
|
|
|
|
|
|
// Check if all lines in the selected block are commented.
|
|
|
bool is_commented = true;
|
|
@@ -1377,7 +1377,7 @@ void CodeTextEditor::toggle_inline_comment(const String &delimiter) {
|
|
|
int offset = (is_commented ? -1 : 1) * delimiter.length();
|
|
|
int col_from = text_editor->get_selection_from_column() > 0 ? text_editor->get_selection_from_column() + offset : 0;
|
|
|
|
|
|
- if (is_commented && text_editor->cursor_get_column() == text_editor->get_line(text_editor->cursor_get_line()).length() + 1) {
|
|
|
+ if (is_commented && text_editor->get_caret_column() == text_editor->get_line(text_editor->get_caret_line()).length() + 1) {
|
|
|
cursor_pos += 1;
|
|
|
}
|
|
|
|
|
@@ -1385,19 +1385,19 @@ void CodeTextEditor::toggle_inline_comment(const String &delimiter) {
|
|
|
col_to += offset;
|
|
|
}
|
|
|
|
|
|
- if (text_editor->cursor_get_column() != 0) {
|
|
|
+ if (text_editor->get_caret_column() != 0) {
|
|
|
cursor_pos += offset;
|
|
|
}
|
|
|
|
|
|
text_editor->select(begin, col_from, text_editor->get_selection_to_line(), col_to);
|
|
|
- text_editor->cursor_set_column(cursor_pos);
|
|
|
+ text_editor->set_caret_column(cursor_pos);
|
|
|
|
|
|
} else {
|
|
|
- int begin = text_editor->cursor_get_line();
|
|
|
+ int begin = text_editor->get_caret_line();
|
|
|
String line_text = text_editor->get_line(begin);
|
|
|
int delimiter_length = delimiter.length();
|
|
|
|
|
|
- int col = text_editor->cursor_get_column();
|
|
|
+ int col = text_editor->get_caret_column();
|
|
|
if (line_text.begins_with(delimiter)) {
|
|
|
line_text = line_text.substr(delimiter_length, line_text.length());
|
|
|
col -= delimiter_length;
|
|
@@ -1407,7 +1407,7 @@ void CodeTextEditor::toggle_inline_comment(const String &delimiter) {
|
|
|
}
|
|
|
|
|
|
text_editor->set_line(begin, line_text);
|
|
|
- text_editor->cursor_set_column(col);
|
|
|
+ text_editor->set_caret_column(col);
|
|
|
}
|
|
|
text_editor->end_complex_operation();
|
|
|
text_editor->update();
|
|
@@ -1428,7 +1428,7 @@ void CodeTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
|
|
|
|
|
|
void CodeTextEditor::goto_line_centered(int p_line) {
|
|
|
goto_line(p_line);
|
|
|
- text_editor->call_deferred(SNAME("center_viewport_to_cursor"));
|
|
|
+ text_editor->call_deferred(SNAME("center_viewport_to_caret"));
|
|
|
}
|
|
|
|
|
|
void CodeTextEditor::set_executing_line(int p_line) {
|
|
@@ -1444,8 +1444,8 @@ Variant CodeTextEditor::get_edit_state() {
|
|
|
|
|
|
state["scroll_position"] = text_editor->get_v_scroll();
|
|
|
state["h_scroll_position"] = text_editor->get_h_scroll();
|
|
|
- state["column"] = text_editor->cursor_get_column();
|
|
|
- state["row"] = text_editor->cursor_get_line();
|
|
|
+ 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()) {
|
|
@@ -1469,8 +1469,8 @@ void CodeTextEditor::set_edit_state(const Variant &p_state) {
|
|
|
Dictionary state = p_state;
|
|
|
|
|
|
/* update the row first as it sets the column to 0 */
|
|
|
- text_editor->cursor_set_line(state["row"]);
|
|
|
- text_editor->cursor_set_column(state["column"]);
|
|
|
+ text_editor->set_caret_line(state["row"]);
|
|
|
+ text_editor->set_caret_column(state["column"]);
|
|
|
text_editor->set_v_scroll(state["scroll_position"]);
|
|
|
text_editor->set_h_scroll(state["h_scroll_position"]);
|
|
|
|
|
@@ -1517,9 +1517,9 @@ void CodeTextEditor::set_error_pos(int p_line, int p_column) {
|
|
|
void CodeTextEditor::goto_error() {
|
|
|
if (error->get_text() != "") {
|
|
|
text_editor->unfold_line(error_line);
|
|
|
- text_editor->cursor_set_line(error_line);
|
|
|
- text_editor->cursor_set_column(error_column);
|
|
|
- text_editor->center_viewport_to_cursor();
|
|
|
+ text_editor->set_caret_line(error_line);
|
|
|
+ text_editor->set_caret_column(error_column);
|
|
|
+ text_editor->center_viewport_to_caret();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1712,7 +1712,7 @@ void CodeTextEditor::set_warning_count(int p_warning_count) {
|
|
|
}
|
|
|
|
|
|
void CodeTextEditor::toggle_bookmark() {
|
|
|
- int line = text_editor->cursor_get_line();
|
|
|
+ int line = text_editor->get_caret_line();
|
|
|
text_editor->set_line_as_bookmarked(line, !text_editor->is_line_bookmarked(line));
|
|
|
}
|
|
|
|
|
@@ -1722,18 +1722,18 @@ void CodeTextEditor::goto_next_bookmark() {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- int line = text_editor->cursor_get_line();
|
|
|
+ int line = text_editor->get_caret_line();
|
|
|
if (line >= (int)bmarks[bmarks.size() - 1]) {
|
|
|
text_editor->unfold_line(bmarks[0]);
|
|
|
- text_editor->cursor_set_line(bmarks[0]);
|
|
|
- text_editor->center_viewport_to_cursor();
|
|
|
+ text_editor->set_caret_line(bmarks[0]);
|
|
|
+ text_editor->center_viewport_to_caret();
|
|
|
} else {
|
|
|
for (int i = 0; i < bmarks.size(); i++) {
|
|
|
int bmark_line = bmarks[i];
|
|
|
if (bmark_line > line) {
|
|
|
text_editor->unfold_line(bmark_line);
|
|
|
- text_editor->cursor_set_line(bmark_line);
|
|
|
- text_editor->center_viewport_to_cursor();
|
|
|
+ text_editor->set_caret_line(bmark_line);
|
|
|
+ text_editor->center_viewport_to_caret();
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -1746,18 +1746,18 @@ void CodeTextEditor::goto_prev_bookmark() {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- int line = text_editor->cursor_get_line();
|
|
|
+ int line = text_editor->get_caret_line();
|
|
|
if (line <= (int)bmarks[0]) {
|
|
|
text_editor->unfold_line(bmarks[bmarks.size() - 1]);
|
|
|
- text_editor->cursor_set_line(bmarks[bmarks.size() - 1]);
|
|
|
- text_editor->center_viewport_to_cursor();
|
|
|
+ text_editor->set_caret_line(bmarks[bmarks.size() - 1]);
|
|
|
+ text_editor->center_viewport_to_caret();
|
|
|
} else {
|
|
|
for (int i = bmarks.size(); i >= 0; i--) {
|
|
|
int bmark_line = bmarks[i];
|
|
|
if (bmark_line < line) {
|
|
|
text_editor->unfold_line(bmark_line);
|
|
|
- text_editor->cursor_set_line(bmark_line);
|
|
|
- text_editor->center_viewport_to_cursor();
|
|
|
+ text_editor->set_caret_line(bmark_line);
|
|
|
+ text_editor->center_viewport_to_caret();
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -1913,7 +1913,7 @@ CodeTextEditor::CodeTextEditor() {
|
|
|
line_and_col_txt->set_mouse_filter(MOUSE_FILTER_STOP);
|
|
|
|
|
|
text_editor->connect("gui_input", callable_mp(this, &CodeTextEditor::_text_editor_gui_input));
|
|
|
- text_editor->connect("cursor_changed", callable_mp(this, &CodeTextEditor::_line_col_changed));
|
|
|
+ text_editor->connect("caret_changed", callable_mp(this, &CodeTextEditor::_line_col_changed));
|
|
|
text_editor->connect("text_changed", callable_mp(this, &CodeTextEditor::_text_changed));
|
|
|
text_editor->connect("request_code_completion", callable_mp(this, &CodeTextEditor::_complete_request));
|
|
|
TypedArray<String> cs;
|