MG: fixed synedit SelText linebreaks and pascalparser of hex char consts

git-svn-id: trunk@1620 -
This commit is contained in:
lazarus 2002-04-20 14:51:21 +00:00
parent d7dc26482d
commit 6c8804716a
2 changed files with 38 additions and 9 deletions

View File

@ -515,11 +515,20 @@ begin
'#':
begin
i:=CurPos.StartPos+1;
while (i<=SrcLen) and (IsNumberChar[Src[i]]) do
inc(i);
if (i<=SrcLen)
and (not (Src[i] in ['''','#'])) then
Result:=true;
if (i<=SrcLen) then begin
if IsNumberChar[Src[i]] then begin
// decimal
while (i<=SrcLen) and (IsNumberChar[Src[i]]) do
inc(i);
end else if Src[i]='$' then begin
// hexadecimal
while (i<=SrcLen) and (IsHexNumberChar[Src[i]]) do
inc(i);
end;
if (i<=SrcLen)
and (not (Src[i] in ['''','#'])) then
Result:=true;
end;
end;
'''':
@ -672,9 +681,21 @@ begin
'#':
begin
inc(CurPos.EndPos);
while (CurPos.EndPos<=SrcLen)
and (IsNumberChar[Src[CurPos.EndPos]]) do
inc(CurPos.EndPos);
if (CurPos.EndPos<=SrcLen) then begin
if (IsNumberChar[Src[CurPos.EndPos]]) then begin
// decimal
repeat
inc(CurPos.EndPos);
until (CurPos.EndPos>SrcLen)
or (not IsNumberChar[Src[CurPos.EndPos]]);
end else if Src[CurPos.EndPos]='$' then begin
// hexadecimal
repeat
inc(CurPos.EndPos);
until (CurPos.EndPos>SrcLen)
or (not IsHexNumberChar[Src[CurPos.EndPos]]);
end;
end;
end;
'''':
begin

View File

@ -1346,9 +1346,14 @@ function TCustomSynEdit.GetSelText: string;
FillChar(P^, Len, #$20);
Inc(P, Len);
end;
{$IFDEF SYN_LAZARUS}
var
sLineBreak: string;
{$ELSE}
const
sLineBreak = #$0D#$0A;
{$ENDIF}
var
First, Last, TotalLen: Integer;
ColFrom, ColTo: Integer;
@ -1361,6 +1366,9 @@ var
{$ENDIF}
P: PChar;
begin
{$IFDEF SYN_LAZARUS}
sLineBreak:=AdjustLineBreaks(#$0D#$0A);
{$ENDIF}
if not SelAvail then
Result := ''
else begin