From d1a81f63bd7375d8488a2832f1ed8c7a3b5dc655 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 23 Jan 2012 13:06:11 +0000 Subject: [PATCH] SourceEdit: Starting (alpha): show current class/proc header even if scrolled out git-svn-id: trunk@34884 - --- ide/sourcesyneditor.pas | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/ide/sourcesyneditor.pas b/ide/sourcesyneditor.pas index 8be0552177..8b4e917811 100644 --- a/ide/sourcesyneditor.pas +++ b/ide/sourcesyneditor.pas @@ -395,27 +395,34 @@ begin FSrcSynCaretChangedLock := True; try - InfCnt := TextView.OpenFoldCount(CaretY-1); ListCnt := 0; - for i := InfCnt-1 downto 0 do begin - Inf := TextView.OpenFoldInfo(CaretY-1, i); - if sfaInvalid in Inf.HNode.FoldAction then - continue; - if (TPascalCodeFoldBlockType(Inf.HNode.FoldType) in [cfbtClassSection]) and (ListCnt = 0) then begin - InfList[ListCnt] := Inf; - inc(ListCnt); - end; + if CaretY >= TopLine then begin + InfCnt := TextView.OpenFoldCount(CaretY-1); + for i := InfCnt-1 downto 0 do begin + Inf := TextView.OpenFoldInfo(CaretY-1, i); + if sfaInvalid in Inf.HNode.FoldAction then + continue; - if (TPascalCodeFoldBlockType(Inf.HNode.FoldType) in [cfbtClass]) and (ListCnt < 2) then begin - InfList[ListCnt] := Inf; - inc(ListCnt); - end; - - if (TPascalCodeFoldBlockType(Inf.HNode.FoldType) in [cfbtProcedure]) and (ListCnt < 2) then begin - InfList[ListCnt] := Inf; - if ListCnt = 0 then + if (TPascalCodeFoldBlockType(Inf.HNode.FoldType) in [cfbtClassSection]) and (ListCnt = 0) then begin + InfList[ListCnt] := Inf; inc(ListCnt); + end; + + if (TPascalCodeFoldBlockType(Inf.HNode.FoldType) in [cfbtClass]) and (ListCnt < 2) then begin + InfList[ListCnt] := Inf; + inc(ListCnt); + end; + + if (TPascalCodeFoldBlockType(Inf.HNode.FoldType) in [cfbtProcedure]) and (ListCnt < 2) then begin + InfList[ListCnt] := Inf; + inc(ListCnt); + end; + if (TPascalCodeFoldBlockType(Inf.HNode.FoldType) in [cfbtProcedure]) and (ListCnt = 2) and + (TPascalCodeFoldBlockType(InfList[ListCnt-1].HNode.FoldType) = cfbtProcedure) + then begin + InfList[ListCnt-1] := Inf; + end; end; end;