Skip to content

Commit

Permalink
Exclude selection when checking MaxLength limit during text paste
Browse files Browse the repository at this point in the history
The selected text is replaced after pasting so it should always be ignored.
  • Loading branch information
4O4 committed Dec 23, 2016
1 parent fbc50d5 commit cda09b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Client/gui/CGUI_Impl.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit cda09b4

Please sign in to comment.