win32 interface: fixed retrieving memo line (bug #11519)

git-svn-id: trunk@15577 -
This commit is contained in:
vincents 2008-06-26 14:24:28 +00:00
parent 3c3f190780
commit beff60f884

View File

@ -84,11 +84,16 @@ var
{$endif WindowsUnicodeSupport}
begin
len := GetLineLength(Index);
if len=0 then
begin
Result := '';
exit;
end;
{$ifdef WindowsUnicodeSupport}
if UnicodeEnabledOS then
begin
Setlength(WideBuffer, len);
PWord(@WideBuffer[1])^ := len+1;
len := SendMessageW(fHandle, EM_GETLINE, Index, lparam(PWideChar(WideBuffer)));
Result := Utf8Encode(WideBuffer);
@ -96,13 +101,13 @@ begin
else
begin
Setlength(AnsiBuffer, len);
PWord(@AnsiBuffer[1])^ := len+1;
len := SendMessage(fHandle, EM_GETLINE, Index, lparam(PChar(AnsiBuffer)));
Result := AnsiToUtf8(AnsiBuffer);
end;
{$else}
Setlength(Result, len);
if len = 0 then Exit;
// no need for temp buf and moving
// the result is without null terminator.