Wrong position happens when append to a multibyte charset string in TMemo
Original Reporter info from Mantis: Luke Liu
-
Reporter name:
Original Reporter info from Mantis: Luke Liu
- Reporter name:
Description:
On Windows XP sp3 x86, when adding a new string to the tail of a existing multibyte charset string with the "TMemo.Append" or "TMemo.Lines.Add" procedure, the new string is inserted to a wrong position.
This happens in both 0.9.30 and 1.0.2. Not tested in other versions and Windows OSs.
Additional information:
In the file "lcl\interfaces\win32\win32memostrings.inc", I replaced each "SendMessage(FHandle, EM_SETSEL, LineStart, LineStart);" in the procedure "TWin32MemoStrings.Insert" with the following content, and the problem disappeared:
{$ifdef WindowsUnicodeSupport}
if UnicodeEnabledOS
then SendMessageW(FHandle, EM_SETSEL, LineStart, LineStart)
else SendMessage(FHandle, EM_SETSEL, LineStart, LineStart);
{$else}
SendMessage(FHandle, EM_SETSEL, LineStart, LineStart);
{$endif}
BTW: maybe the procedure "TWin32MemoStrings.Delete" could cause the same kind problem.
Mantis conversion info:
- Mantis ID: 23232
- Version: 0.9.30
- Fixed in revision: r46042 (#acde1c2b)
- Monitored by: » Luke Liu (Luke Liu)
- Target version: 1.2.6