diff --git a/components/codetools/customcodetool.pas b/components/codetools/customcodetool.pas index a96e351eb1..6891a5dce3 100644 --- a/components/codetools/customcodetool.pas +++ b/components/codetools/customcodetool.pas @@ -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 diff --git a/components/synedit/synedit.pp b/components/synedit/synedit.pp index 59e755d02f..63cb600293 100644 --- a/components/synedit/synedit.pp +++ b/components/synedit/synedit.pp @@ -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