diff options
| author | Danil Alexeev <danil@alexeev.xyz> | 2020-09-14 21:14:27 +0300 |
|---|---|---|
| committer | Danil Alexeev <danil@alexeev.xyz> | 2020-09-14 21:57:54 +0300 |
| commit | fb6eb21afc0a98b2b1439268abb0facd53222a43 (patch) | |
| tree | fb7b14454b791413e10935019982c044b4f4aee4 /scene/gui/rich_text_label.cpp | |
| parent | c5f7a581f7247f599b07b0346062db39e52c7d5a (diff) | |
| download | redot-engine-fb6eb21afc0a98b2b1439268abb0facd53222a43.tar.gz | |
Improvement for the Copy button in the Output Log
Now if no text is selected, pressing the Copy button copies the entire text.
Diffstat (limited to 'scene/gui/rich_text_label.cpp')
| -rw-r--r-- | scene/gui/rich_text_label.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index fb4931ea91..e8acac172c 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -2529,9 +2529,9 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p return false; } -void RichTextLabel::selection_copy() { +String RichTextLabel::get_selected_text() { if (!selection.active || !selection.enabled) { - return; + return ""; } String text; @@ -2561,6 +2561,12 @@ void RichTextLabel::selection_copy() { item = _get_next_item(item, true); } + return text; +} + +void RichTextLabel::selection_copy() { + String text = get_selected_text(); + if (text != "") { DisplayServer::get_singleton()->clipboard_set(text); } |
