From cda09b4c6b6c9815e5f8d3520f763e7aace7194b Mon Sep 17 00:00:00 2001 From: 4O4 Date: Fri, 23 Dec 2016 18:24:44 +0100 Subject: [PATCH] Exclude selection when checking MaxLength limit during text paste The selected text is replaced after pasting so it should always be ignored. --- Client/gui/CGUI_Impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/gui/CGUI_Impl.cpp b/Client/gui/CGUI_Impl.cpp index 1bea5b6810..6b2ad38656 100644 --- a/Client/gui/CGUI_Impl.cpp +++ b/Client/gui/CGUI_Impl.cpp @@ -907,7 +907,7 @@ bool CGUI_Impl::Event_KeyDown ( const CEGUI::EventArgs& Args ) // Put the editbox's data into a string and insert the data if it has not reached it's maximum text length std::wstring tmp = MbUTF8ToUTF16(strEditText.c_str()); - if ( ( strClipboardText.length () + tmp.length () ) <= iMaxLength ) + if ( ( strClipboardText.length () + tmp.length () - iSelectionLength ) <= iMaxLength ) { // Are there characters selected? size_t sizeCaratIndex = 0;