From fd99df5372a0f80fdfd3968d74b443c07e032276 Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 20 Jan 2007 11:44:36 +0000 Subject: [PATCH] synedit: fixed cursor movement with Tabs and not eoScrollPastEOL git-svn-id: trunk@10483 - --- components/synedit/synedit.pp | 44 +++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/components/synedit/synedit.pp b/components/synedit/synedit.pp index 38824988be..3e14d1f41e 100644 --- a/components/synedit/synedit.pp +++ b/components/synedit/synedit.pp @@ -761,7 +761,8 @@ type LogicalPos: integer): integer; function LogicalToPhysicalCol(Line: PChar; LineLen: integer; LogicalPos, StartBytePos, StartPhysicalPos: integer): integer; - function PhysicalLineLength(Line: PChar; LineLen: integer): integer; + function PhysicalLineLength(Line: PChar; LineLen: integer; + WithTabs: boolean): integer; function PhysicalToLogicalPos(const p: TPoint): TPoint; function PhysicalToLogicalCol(const Line: string; PhysicalPos: integer): integer; @@ -1671,7 +1672,7 @@ begin else if (Line>=1) and (Line<=Lines.Count) then begin s:=Lines[Line-1]; if (Result<=length(s)) and UseUTF8 then - Result:=UTF8FindNearestCharStart(PChar(s),length(s),Result); + Result:=UTF8FindNearestCharStart(PChar(Pointer(s)),length(s),Result); end; end; @@ -1744,7 +1745,7 @@ function TCustomSynEdit.GetSelText: string; Result := Copy(S, Index, Count) else begin SetLength(Result, DstLen); - P := PChar(Result); + P := PChar(Pointer(Result)); StrPCopy(P, Copy(S, Index, Count)); Inc(P, SrcLen); FillChar(P^, DstLen - Srclen, $20); @@ -1761,7 +1762,7 @@ function TCustomSynEdit.GetSelText: string; SrcLen := Length(S); if (Index <= SrcLen) and (Count > 0) then begin Dec(Index); - pSrc := PChar(S) + Index; + pSrc := PChar(Pointer(S)) + Index; DstLen := Min(SrcLen - Index, Count); Move(pSrc^, P^, DstLen); Inc(P, DstLen); @@ -1822,7 +1823,7 @@ begin Inc(TotalLen, Length(sLineBreak) * (Last - First)); // step2: build up result string SetLength(Result, TotalLen); - P := PChar(Result); + P := PChar(Pointer(Result)); CopyAndForward(Lines[First], ColFrom, MaxInt, P); CopyAndForward(sLineBreak, 1, MaxInt, P); for i := First + 1 to Last - 1 do begin @@ -1845,7 +1846,7 @@ begin TotalLen := ColLen + (ColLen + Length(sLineBreak)) * (Last - First); // step2: build up result string SetLength(Result, TotalLen); - P := PChar(Result); + P := PChar(Pointer(Result)); for i := First to Last - 1 do begin CopyPaddedAndForward(Lines[i], ColFrom, ColLen, P); CopyAndForward(sLineBreak, 1, MaxInt, P); @@ -1889,7 +1890,7 @@ begin Dec(TotalLen, Length(sLineBreak)); // step2: build up result string SetLength(Result, TotalLen); - P := PChar(Result); + P := PChar(Pointer(Result)); for i := First to Last - 1 do begin CopyAndForward(Lines[i], 1, MaxInt, P); CopyAndForward(sLineBreak, 1, MaxInt, P); @@ -3014,7 +3015,7 @@ begin s := fGutter.FormatLineNumber(iLine); Inc(rcLine.Bottom, fTextHeight); fTextDrawer.ExtTextOut(CodeFoldOffset+fGutter.LeftOffset, - rcLine.Top, ETO_OPAQUE,rcLine,PChar(S),Length(S)); + rcLine.Top, ETO_OPAQUE,rcLine,PChar(Pointer(S)),Length(S)); end; {$ELSE} s := fGutter.FormatLineNumber(iLine); @@ -3272,7 +3273,7 @@ var SrcPos:=0; DestPos:=0; ScreenPos:=PhysicalStartPos; - Dest:=PChar(ExpandedPaintToken); + Dest:=PChar(Pointer(ExpandedPaintToken)); while SrcPos