Search code examples
c++mfcvisual-studio-2017cricheditctrl

CRichEditCtrl won't let edits put it above 160560 bytes?


At about 1600 lines, about 100 chars per line, typing more neither shows up in the buffer nor calls the

ON_CONTROL( EN_CHANGE, IDC_PATCH, OnUpdate    )

callback.

If I paste into the buffer, only enough characters to come up to this limit are being pasted. For instance if there is room for 10 characters, and you paste a 30-character phrase, only 10 characters are actually inserted.

Both cases occur whether the added characters are at the end or not.

This happens to be a 64-bit Visual Studio C++ 2017 app running on Windows 10 Pro.


Solution

  • After creation, prich->GetLimitText() gives 32767, which apparently was the maximum amount of text the original version could hold. However, it let me put in far more--near 160k--and continue editing up to that 160k limit.

    Some articles on the internet imply that it has or had an internal hardcoded "maximum maximum" of 0xffffff, but I find I can add another f to that and GetLimitText() reports the higher value. Not clear if that higher value has actual efficacy or whether my set value is being returned but not necessarily heeded or supported.

    My solution is to call prich->LimitText( 0xfffffff ), which is more than my users will ever need.