Merge pull request #14772 from poke1024/fix14539

Fix cut-copy-line breaking paste (issue 14539)
This commit is contained in:
Rémi Verschelde 2017-12-17 19:28:16 +01:00 committed by GitHub
commit 9b86703fd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -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";

View File

@ -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;