2
0
Эх сурвалжийг харах

Merge pull request #14772 from poke1024/fix14539

Fix cut-copy-line breaking paste (issue 14539)
Rémi Verschelde 7 жил өмнө
parent
commit
9b86703fd9

+ 5 - 5
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";

+ 1 - 1
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;