TAdvMemo text not painted for very long line

It appears that I am using version 2.3.0.1 of TAdvMemo.

I created a simple app and pasted much of the TAdvMemo guide's text into a single line.  There seems to be a threshold between 4,040 and 4,876 characters that causes the line to not be printed in the memo.

Click and dragging or holding shift and using the arrow keys to highlight all or a portion of the line the text causes the highlighted portion to become visible.   Also using shift+end to highlight the entire line does not cause the highlighted text to be visible, but holding shift and pressing the arrow keys to deselect text causes the deselected characters to be printed and selected characters to be hidden.





To recreate, start with a new VCL Forms Application.  Add only a TAdvMemo.  In the constructor add the following:

__fastcall TForm3::TForm3(TComponent* Owner)
	: TForm(Owner)
{
	AdvMemo1->Lines->Clear();
	AdvMemo1->Lines->Add(
		"The TMS TAdvMemo is a highly configurable syntax highlighting memo control. " 		"The TMS TAdvMemo has features like code-folding, auto completion, breakpoints indicators and " 		"bookmarks and markers support, and has an interface to a source code container to simultaneously " 		"edit multiple source files from the same memo control. " 		"In this document you will find an overview of the TAdvMemo component and its features, code " 		"snippets to quickly start using the component and overviews of properties, methods and events. " 		"These properties, methods and events also apply to the TDBAdvDemo component, a DB-aware " 		"version of TAdvMemo." 		"TMS TAdvMemo is available as VCL component for Delphi and C++Builder. " 		"TMS TAdvMemo is available for Delphi 5,6,7,2007,2009,2010,XE,XE2,XE3 & C++Builder " 		"5,6,2007,2009,2010,XE,XE2,XE3. " 		"TMS TAdvMemo has been designed for and tested with: Windows XP, Vista, and Windows 7 and with " 		"Delphi XE2 & Delphi XE3, it can be used in both 32bit and 64bit Windows applications. " 		"TAdvMemo: Is the core syntax highlighting memo component and offers syntax highlighting for a " 		"large number of programming languages including the customizability of syntax highlighting for " 		"custom scripting languages. " 		"TDBAdvMemo: Is the data-aware version of TAdvMemo. " 		"TAdvCodeList: Provides the capability to create a list with predefined source code snippets that can " 		"be dragged & dropped betwee the TAdvMemoand the TAdvCodeList.. " 		"TAdvMemoSource: Allows connecting different source files to one TAdvMemo control. This can be " 		"used to optimize memory usage in multi document applications. " 		"TAdvMemoFindDialog: Allows searching for a certain (sub-) string in the TAdvMemo control. " 		"TAdvMemoFindReplaceDialog: Allows searching for a certain (sub-) string in the TAdvMemo control, " 		"and replace it with another text string. " 		"TAdvFindDialog: Extended find dialog with specifiers for expressions in search, auto history of search " 		"strings. " 		"TAdvReplaceDialog: Extended find & replace dialog with specifiers for expressions in search, auto " 		"history of search & replace strings. " 		"TAdvMemoCapitalChecker: Is an extension of the standard TAdvMemo that allows checking for " 		"capital letters at the start of a sentence. This feature is useful when creating a standard text editor. " 		"TAdvMemoStylerManager: Allows managing of an existing MemoStyler (or even creating a new one). " 		"MemoStylers provide predefined color-coding of user-defined code syntax. " 		"TAdvBasicMemoStyler: Component holding syntax settings for the MS Visual Basic language. " 		"TAdvCSharpMemoStyler: Component holding syntax settings for the C# files syntax checking. " 		"TAdvCSSMemoStyler: Component holding syntax settings for CSS files. " 		"TAdvEmoticonMemoStyler: Component holding syntax settings to automatically display Emoticons as " 		"replacement for emoticon character sequences. " 		"TAdvHTMLMemoStyler: Component holding syntax settings for HTML files. " 		"TAdvINIMemoStyler: Component holding syntax settings for INI files. " 		"TAdvJSMemoStyler: Component holding syntax settings for the JavaScript language. " 		"TAdvPascalMemoStyler: Component holding syntax settings for the Pascal language. " 		"TAdvPerlMemoStyler: Component holding syntax settings for the Perl language. " 		"TAdvPHPMemoStyler: Component holding syntax settings for the PHP language. " 		"TAdvPythonMemoStyler: Component holding syntax settings for the Python language. " 		"TAdvSQLMemoStyler: Component holding syntax settings for SQL files. " 		"TAdvWebMemoStyler: Component holding syntax settings for Web files (HTML, CSS, Javascript). " 		"TAdvXMLMemoStyler: Component holding syntax settings for XML files. " 		"The TMS TAdvMemo is a highly configurable syntax highlighting memo control with support for codefolding. " 		"The TMS TAdvMemo has features like auto completion and auto correction, bookmarks support, " 		"markers and breakpoint indication and can optionally interface to a source code container for easy & " 		"memory friendly multi-source editing. " 		"The TMS TAdvMemo component comes with built-in support for a wide range of programming " 		"languages and custom language syntax highlighting can be added. "	);

	AdvMemo1->Lines->Add(
		"The TMS TAdvMemo is a highly configurable syntax highlighting memo control. " 		"The TMS TAdvMemo has features like code-folding, auto completion, breakpoints indicators and " 		"bookmarks and markers support, and has an interface to a source code container to simultaneously " 		"edit multiple source files from the same memo control. " 		"In this document you will find an overview of the TAdvMemo component and its features, code " 		"snippets to quickly start using the component and overviews of properties, methods and events. " 		"These properties, methods and events also apply to the TDBAdvDemo component, a DB-aware " 		"version of TAdvMemo." 		"TMS TAdvMemo is available as VCL component for Delphi and C++Builder. " 		"TMS TAdvMemo is available for Delphi 5,6,7,2007,2009,2010,XE,XE2,XE3 & C++Builder " 		"5,6,2007,2009,2010,XE,XE2,XE3. " 		"TMS TAdvMemo has been designed for and tested with: Windows XP, Vista, and Windows 7 and with " 		"Delphi XE2 & Delphi XE3, it can be used in both 32bit and 64bit Windows applications. " 		"TAdvMemo: Is the core syntax highlighting memo component and offers syntax highlighting for a " 		"large number of programming languages including the customizability of syntax highlighting for " 		"custom scripting languages. " 		"TDBAdvMemo: Is the data-aware version of TAdvMemo. " 		"TAdvCodeList: Provides the capability to create a list with predefined source code snippets that can " 		"be dragged & dropped betwee the TAdvMemoand the TAdvCodeList.. " 		"TAdvMemoSource: Allows connecting different source files to one TAdvMemo control. This can be " 		"used to optimize memory usage in multi document applications. " 		"TAdvMemoFindDialog: Allows searching for a certain (sub-) string in the TAdvMemo control. " 		"TAdvMemoFindReplaceDialog: Allows searching for a certain (sub-) string in the TAdvMemo control, " 		"and replace it with another text string. " 		"TAdvFindDialog: Extended find dialog with specifiers for expressions in search, auto history of search " 		"strings. " 		"TAdvReplaceDialog: Extended find & replace dialog with specifiers for expressions in search, auto " 		"history of search & replace strings. " 		"TAdvMemoCapitalChecker: Is an extension of the standard TAdvMemo that allows checking for " 		"capital letters at the start of a sentence. This feature is useful when creating a standard text editor. " 		"TAdvMemoStylerManager: Allows managing of an existing MemoStyler (or even creating a new one). " 		"MemoStylers provide predefined color-coding of user-defined code syntax. " 		"TAdvBasicMemoStyler: Component holding syntax settings for the MS Visual Basic language. " 		"TAdvCSharpMemoStyler: Component holding syntax settings for the C# files syntax checking. " 		"TAdvCSSMemoStyler: Component holding syntax settings for CSS files. " 		"TAdvEmoticonMemoStyler: Component holding syntax settings to automatically display Emoticons as " 		"replacement for emoticon character sequences. " 		"TAdvHTMLMemoStyler: Component holding syntax settings for HTML files. " 		"TAdvINIMemoStyler: Component holding syntax settings for INI files. " 		"TAdvJSMemoStyler: Component holding syntax settings for the JavaScript language. " 		"TAdvPascalMemoStyler: Component holding syntax settings for the Pascal language. " 		"TAdvPerlMemoStyler: Component holding syntax settings for the Perl language. " 		"TAdvPHPMemoStyler: Component holding syntax settings for the PHP language. " 		"TAdvPythonMemoStyler: Component holding syntax settings for the Python language. " 		"TAdvSQLMemoStyler: Component holding syntax settings for SQL files. " 		"TAdvWebMemoStyler: Component holding syntax settings for Web files (HTML, CSS, Javascript). " 		"TAdvXMLMemoStyler: Component holding syntax settings for XML files. " 		"The TMS TAdvMemo is a highly configurable syntax highlighting memo control with support for codefolding. " 		"The TMS TAdvMemo has features like auto completion and auto correction, bookmarks support, " 		"markers and breakpoint indication and can optionally interface to a source code container for easy & " 		"memory friendly multi-source editing. " 		"The TMS TAdvMemo component comes with built-in support for a wide range of programming " 		"languages and custom language syntax highlighting can be added. "		"The core part of the TAdvMemo control is the editor with (1) syntax highlighting (2). A gutter can be "		"displayed that shows line numbers (3) and additional information such as a modified line indicator "		"(4), a bookmark (5), a breakpoint (6), and a marker (8). "		"The active line (9) can be indicated with an active line indicator (green arrow on the left hand side) "		"and/or a highlighted blue line. Start and end of code block indication is optionally available as well "		"(7). "		"Code completion (10) can be activated by pressing the Ctrl + Spacebar keys or can automatically "		"appear for class methods, events, properties. An optional right margin indicator is drawn (11). "		"On the right hand side, an example of a TAdvCodeList control (12), holding code blocks (13) is shown. "		"Code blocks can be dragged and dropped from and to the TAdvMemo control."
	);

	AdvMemo1->Lines->Add("b");
}


FYI, using version 6.0.3.0 of TMS Component Pack with version 2.3.0.1 of TAdvMemo.

There is indeed a limitation to this size and this limitation is related to size of bitmaps in Windows. We use a memory bitmap cache for drawing and this has a limited size.

All we can do is add code that would trigger an error when inserting long lines like this (same as the Delphi IDE editor is doing actually)