Merge pull request #22560 from lupoDharkael/clipboard

TextEdit: prevent the copy of an empty string
This commit is contained in:
Rémi Verschelde 2018-09-30 22:49:45 +02:00 committed by GitHub
commit 01e1c6e8b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4545,9 +4545,13 @@ void TextEdit::cut() {
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 = clipboard;
if (text[cursor.line].length() != 0) {
String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length());
OS::get_singleton()->set_clipboard(clipboard);
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);