mirror of
https://github.com/godotengine/godot.git
synced 2024-11-26 22:23:04 +00:00
Merge pull request #22560 from lupoDharkael/clipboard
TextEdit: prevent the copy of an empty string
This commit is contained in:
commit
01e1c6e8b6
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user