Merge pull request #99142 from KoBeWi/pasta_la_vista

Ignore paste action if clipboard is empty
This commit is contained in:
Thaddeus Crews 2024-11-13 08:34:16 -06:00
commit 2778379644
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84

View File

@ -7310,6 +7310,10 @@ void TextEdit::_paste_internal(int p_caret) {
}
String clipboard = DisplayServer::get_singleton()->clipboard_get();
if (clipboard.is_empty()) {
// Nothing to paste.
return;
}
// Paste a full line. Ignore '\r' characters that may have been added to the clipboard by the OS.
if (get_caret_count() == 1 && !has_selection(0) && !cut_copy_line.is_empty() && cut_copy_line == clipboard.replace("\r", "")) {