Notepad2e icon indicating copy to clipboard operation
Notepad2e copied to clipboard

Remove input length limit in dialogs

Open ProgerXP opened this issue 3 years ago • 5 comments
trafficstars

Inputs in Alt+M, Alt+Q and possibly elsewhere don't accept more than 255 symbols (not bytes). Ctrl+F/H inputs accept 500 at most which is better but still insufficient. What is the reason for these limits?

ProgerXP avatar May 07 '22 12:05 ProgerXP

General EDITFINDREPLACE structure contains the following text buffers: 512 - is the max string length (including trailing 0) internally allowed (for now) for proper Find/Replace work.

Other procs use predefined buffers:

cshnik avatar Jun 09 '22 18:06 cshnik

@cshnik Do text inputs have any limits of their own in WinAPI? Or Notepad2's limits are the only reason?

ProgerXP avatar Jun 09 '22 19:06 ProgerXP

MSDN states edit control text length limits (EM_LIMITTEXT):

For single-line edit controls, the text limit is either 0x7FFFFFFE bytes or the value of the wParam parameter, whichever is smaller. For multiline edit controls, this value is either -1 byte or the value of the wParam parameter, whichever is smaller.

Changes required to support unlimited text length are:

  1. Replace fixed length text buffers with struct pointer + length
  2. Implement procs for text buffers allocations/relocations
  3. Review every call to text buffers and fix it accordingly

The simplest way would be to adjust fixed text length to a reasonable big value and let all the other code work as is.

cshnik avatar Jun 29 '22 16:06 cshnik

The simplest way would be to adjust fixed text length to a reasonable big value and let all the other code work as is.

Indeed, let's increase all buffers' lengths by 10. Currently they use 5 KiB in total, this will be 50 KiB then (there is always one _editfindreplace instance per process, right?).

ProgerXP avatar Jun 29 '22 20:06 ProgerXP

Fixed.

cshnik avatar Jul 12 '22 18:07 cshnik

We've increased MRU (#447) and input limits but keep in mind WinAPI's limit of 32767 characters per INI section:

https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getprivateprofilesection

ProgerXP avatar Nov 10 '22 14:11 ProgerXP