fixed synedit ensure cursor pos visible with tab chars

git-svn-id: trunk@2500 -
This commit is contained in:
mattias 2002-08-17 23:41:25 +00:00
parent 62b5b4ef5a
commit d139150e08

View File

@ -5451,15 +5451,18 @@ begin
end; end;
procedure TCustomSynEdit.EnsureCursorPosVisible; procedure TCustomSynEdit.EnsureCursorPosVisible;
var
PhysCaretXY: TPoint;
begin begin
IncPaintLock; IncPaintLock;
try try
// Make sure X is visible // Make sure X is visible
//writeln('[TCustomSynEdit.EnsureCursorPosVisible] A CaretX=',CaretX,' LeftChar=',LeftChar,' CharsInWindow=',CharsInWindow,' ClientWidth=',ClientWidth); //writeln('[TCustomSynEdit.EnsureCursorPosVisible] A CaretX=',CaretX,' LeftChar=',LeftChar,' CharsInWindow=',CharsInWindow,' ClientWidth=',ClientWidth);
if CaretX < LeftChar then PhysCaretXY:=LogicalToPhysicalPos(CaretXY);
LeftChar := CaretX if PhysCaretXY.X < LeftChar then
else if CaretX > CharsInWindow + LeftChar then LeftChar := PhysCaretXY.X
LeftChar := CaretX - CharsInWindow + 1 else if PhysCaretXY.X > CharsInWindow + LeftChar then
LeftChar := PhysCaretXY.X - CharsInWindow + 1
else else
LeftChar := LeftChar; //mh 2000-10-19 LeftChar := LeftChar; //mh 2000-10-19
// Make sure Y is visible // Make sure Y is visible