From 76a07b31e430b8a83ab6851af89ea9718b266e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20C=C3=A9sar=20Neves=20Enumo?= Date: Sat, 22 May 2021 17:29:32 -0300 Subject: [PATCH] TextEditor: Prevent pasting with empty clipboard Prevent erasing selected text when pasting with empty clipboard --- Userland/Libraries/LibGUI/TextEditor.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 27de6f61d2c..8de8cc8acf6 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -1286,6 +1286,10 @@ void TextEditor::paste() return; auto paste_text = Clipboard::the().data(); + + if (paste_text.is_empty()) + return; + printf("Paste: \"%s\"\n", String::copy(paste_text).characters()); TemporaryChange change(m_automatic_indentation_enabled, false);