mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-20 12:19:31 +02:00
win32 interface: fixed retrieving memo line (bug #11519)
git-svn-id: trunk@15577 -
This commit is contained in:
parent
3c3f190780
commit
beff60f884
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user