diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 83aee5ca300..07f1bdf8e5e 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -4084,7 +4084,7 @@ void TextEdit::cut() { backspace_at_cursor(); update(); cursor_set_line(cursor.line + 1); - cut_copy_line = true; + cut_copy_line = clipboard; } else { @@ -4098,7 +4098,7 @@ void TextEdit::cut() { selection.active = false; selection.selecting_mode = Selection::MODE_NONE; update(); - cut_copy_line = false; + cut_copy_line = ""; } } @@ -4107,11 +4107,11 @@ void TextEdit::copy() { if (!selection.active) { String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length()); OS::get_singleton()->set_clipboard(clipboard); - cut_copy_line = true; + cut_copy_line = clipboard; } else { String clipboard = _base_get_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column); OS::get_singleton()->set_clipboard(clipboard); - cut_copy_line = false; + cut_copy_line = ""; } } @@ -4127,7 +4127,7 @@ void TextEdit::paste() { cursor_set_line(selection.from_line); cursor_set_column(selection.from_column); - } else if (cut_copy_line) { + } else if (!cut_copy_line.empty() && cut_copy_line == clipboard) { cursor_set_column(0); String ins = "\n"; diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index edef28cc25f..836d5c73887 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -270,7 +270,7 @@ class TextEdit : public Control { bool brace_matching_enabled; bool highlight_current_line; bool auto_indent; - bool cut_copy_line; + String cut_copy_line; bool insert_mode; bool select_identifiers_enabled;