summaryrefslogtreecommitdiffstats
path: root/scene/gui/text_edit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/text_edit.cpp')
-rw-r--r--scene/gui/text_edit.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 7b682daa83..a51ef143fa 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1643,21 +1643,14 @@ void TextEdit::_notification(int p_what) {
} break;
case NOTIFICATION_DRAG_END: {
- if (is_drag_successful()) {
- if (selection_drag_attempt) {
- // Dropped elsewhere.
- if (is_editable() && !Input::get_singleton()->is_key_pressed(Key::CMD_OR_CTRL)) {
- delete_selection();
- } else if (deselect_on_focus_loss_enabled) {
- deselect();
- }
- }
- }
- if (drag_caret_index >= 0) {
- if (drag_caret_index < carets.size()) {
- remove_caret(drag_caret_index);
+ remove_drag_caret();
+ if (selection_drag_attempt && is_drag_successful()) {
+ // Dropped elsewhere.
+ if (is_editable() && !Input::get_singleton()->is_key_pressed(Key::CMD_OR_CTRL)) {
+ delete_selection();
+ } else if (deselect_on_focus_loss_enabled) {
+ deselect();
}
- drag_caret_index = -1;
}
selection_drag_attempt = false;
drag_action = false;
@@ -4606,6 +4599,15 @@ void TextEdit::remove_caret(int p_caret) {
}
}
+void TextEdit::remove_drag_caret() {
+ if (drag_caret_index >= 0) {
+ if (drag_caret_index < carets.size()) {
+ remove_caret(drag_caret_index);
+ }
+ drag_caret_index = -1;
+ }
+}
+
void TextEdit::remove_secondary_carets() {
if (carets.size() == 1) {
return;
@@ -8141,7 +8143,7 @@ void TextEdit::_update_gutter_width() {
/* Syntax highlighting. */
Dictionary TextEdit::_get_line_syntax_highlighting(int p_line) {
- return syntax_highlighter.is_null() && !setting_text ? Dictionary() : syntax_highlighter->get_line_syntax_highlighting(p_line);
+ return (syntax_highlighter.is_null() || setting_text) ? Dictionary() : syntax_highlighter->get_line_syntax_highlighting(p_line);
}
/* Deprecated. */