Fix pasting long strings in wxTextCtrl under MSW

Adjust the length limit before pasting to ensure that all text on
clipboard will be successfully pasted, instead of only pasting the part
of it which fits.

Add a unit test checking that this works.

Closes #4646.
This commit is contained in:
Vadim Zeitlin
2019-10-09 01:01:21 +02:00
parent 7a9e969dca
commit efc2a9da2d
3 changed files with 149 additions and 0 deletions

View File

@@ -60,6 +60,8 @@ public:
virtual void GetSelection(long *from, long *to) const wxOVERRIDE;
virtual void Paste() wxOVERRIDE;
virtual void Redo() wxOVERRIDE;
virtual bool CanRedo() const wxOVERRIDE;
@@ -292,6 +294,11 @@ private:
// false if we hit the limit set by SetMaxLength() and so didn't change it.
bool AdjustSpaceLimit();
// Called before pasting to ensure that the limit is at big enough to allow
// pasting the entire text on the clipboard.
void AdjustMaxLengthBeforePaste();
wxMenu* m_privateContextMenu;
bool m_isNativeCaretShown;