summaryrefslogtreecommitdiffstats
path: root/editor/code_editor.cpp
diff options
context:
space:
mode:
authorkit <kitbdev@gmail.com>2024-01-22 18:26:16 -0500
committerkit <kitbdev@gmail.com>2024-04-26 14:24:10 -0400
commit154f727c7a7b766e5a2013c6eeb17fb843e9d7a4 (patch)
tree304ba64536d991c23586da232fecd8b2ec2d2abd /editor/code_editor.cpp
parent6118592c6d88350d01f74faff6fd49754f84a7d0 (diff)
downloadredot-engine-154f727c7a7b766e5a2013c6eeb17fb843e9d7a4.tar.gz
Overhaul TextEdit selection.
The caret is now a part of the selection.
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r--editor/code_editor.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 49896d66d8..238fd00089 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -173,10 +173,8 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col)
if (pos.x != -1) {
if (!preserve_cursor && !is_selection_only()) {
text_editor->unfold_line(pos.y);
- text_editor->set_caret_line(pos.y, false);
- text_editor->set_caret_column(pos.x + text.length(), false);
- text_editor->center_viewport_to_caret(0);
text_editor->select(pos.y, pos.x, pos.y, pos.x + text.length());
+ text_editor->center_viewport_to_caret(0);
line_col_changed_for_result = true;
}
@@ -216,7 +214,7 @@ void FindReplaceBar::_replace() {
text_editor->begin_complex_operation();
if (selection_enabled && is_selection_only()) {
// Restrict search_current() to selected region.
- text_editor->set_caret_line(selection_begin.width, false, true, 0, 0);
+ text_editor->set_caret_line(selection_begin.width, false, true, -1, 0);
text_editor->set_caret_column(selection_begin.height, true, 0);
}
@@ -285,10 +283,10 @@ void FindReplaceBar::_replace_all() {
text_editor->begin_complex_operation();
if (selection_enabled && is_selection_only()) {
- text_editor->set_caret_line(selection_begin.width, false, true, 0, 0);
+ text_editor->set_caret_line(selection_begin.width, false, true, -1, 0);
text_editor->set_caret_column(selection_begin.height, true, 0);
} else {
- text_editor->set_caret_line(0, false, true, 0, 0);
+ text_editor->set_caret_line(0, false, true, -1, 0);
text_editor->set_caret_column(0, true, 0);
}