diff --git a/components/synedit/lazsynedittext.pas b/components/synedit/lazsynedittext.pas index efff0cbf61..8e2ac776d1 100644 --- a/components/synedit/lazsynedittext.pas +++ b/components/synedit/lazsynedittext.pas @@ -112,6 +112,10 @@ type TokenAttr: TSynHighlighterAttributes end; + TLineRange = record + Top, Bottom: TLineIdx; + end; + { TLazSynDisplayView } TLazSynDisplayView = class @@ -127,6 +131,10 @@ type function GetNextHighlighterToken(out ATokenInfo: TLazSynDisplayTokenInfo): Boolean; virtual; function GetLinesCount: Integer; virtual; function GetDrawDividerInfo: TSynDividerDrawConfigSetting; virtual; + + function TextToViewIndex(AIndex: TLineIdx): TLineRange; virtual; + function ViewToTextIndex(AIndex: TLineIdx): TLineIdx; virtual; + //function ViewToTextIndexEx(AIndex: TLineIdx; out AScreenRange: TLineRange): TLineIdx; // todo: gutter info end; @@ -431,6 +439,16 @@ begin Result.Color := clNone; end; +function TLazSynDisplayView.TextToViewIndex(AIndex: TLineIdx): TLineRange; +begin + Result := NextView.TextToViewIndex(AIndex); +end; + +function TLazSynDisplayView.ViewToTextIndex(AIndex: TLineIdx): TLineIdx; +begin + Result := NextView.ViewToTextIndex(AIndex); +end; + { TSynLogicalPhysicalConvertor } procedure TSynLogicalPhysicalConvertor.PrepareWidthsForLine(AIndex: Integer; diff --git a/components/synedit/lazsyntextarea.pp b/components/synedit/lazsyntextarea.pp index cde9b66495..9d2fd1ef98 100644 --- a/components/synedit/lazsyntextarea.pp +++ b/components/synedit/lazsyntextarea.pp @@ -24,7 +24,6 @@ type FCanvas: TCanvas; FTextDrawer: TheTextDrawer; FTheLinesView: TSynEditStrings; - FDisplayView: TLazSynDisplayView; FHighlighter: TSynCustomHighlighter; FMarkupManager: TSynEditMarkupManager; FPaintLineColor, FPaintLineColor2: TSynSelectedColor; @@ -60,7 +59,7 @@ type constructor Create(AOwner: TWinControl; ATextDrawer: TheTextDrawer); destructor Destroy; override; procedure Assign(Src: TLazSynSurface); override; - procedure InvalidateLines(FirstLine, LastLine: TLineIdx); override; + procedure InvalidateLines(FirstTextLine, LastTextLine: TLineIdx); override; function ScreenColumnToXValue(Col: integer): integer; // map screen column to screen pixel function RowColumnToPixels(const RowCol: TPoint): TPoint; @@ -83,7 +82,6 @@ type property LeftChar: Integer read FLeftChar write SetLeftChar; property TheLinesView: TSynEditStrings read FTheLinesView write FTheLinesView; - property DisplayView: TLazSynDisplayView read FDisplayView write FDisplayView; property Highlighter: TSynCustomHighlighter read FHighlighter write FHighlighter; property MarkupManager: TSynEditMarkupManager read FMarkupManager write FMarkupManager; property TextDrawer: TheTextDrawer read FTextDrawer; @@ -105,17 +103,23 @@ type FRightGutterArea: TLazSynSurface; FRightGutterWidth: integer; FTextArea: TLazSynTextArea; + procedure SetLeftGutterArea(AValue: TLazSynSurface); procedure SetLeftGutterWidth(AValue: integer); + procedure SetRightGutterArea(AValue: TLazSynSurface); procedure SetRightGutterWidth(AValue: integer); + procedure SetTextArea(AValue: TLazSynTextArea); protected procedure DoPaint(ACanvas: TCanvas; AClip: TRect); override; + procedure DoDisplayViewChanged; override; procedure BoundsChanged; override; public constructor Create(AOwner: TWinControl); - procedure InvalidateLines(FirstLine, LastLine: TLineIdx); override; - property TextArea: TLazSynTextArea read FTextArea write FTextArea; - property LeftGutterArea: TLazSynSurface read FLeftGutterArea write FLeftGutterArea; - property RightGutterArea: TLazSynSurface read FRightGutterArea write FRightGutterArea; + procedure InvalidateLines(FirstTextLine, LastTextLine: TLineIdx); override; + procedure InvalidateTextLines(FirstTextLine, LastTextLine: TLineIdx); virtual; + procedure InvalidateGutterLines(FirstTextLine, LastTextLine: TLineIdx); virtual; + property TextArea: TLazSynTextArea read FTextArea write SetTextArea; + property LeftGutterArea: TLazSynSurface read FLeftGutterArea write SetLeftGutterArea; + property RightGutterArea: TLazSynSurface read FRightGutterArea write SetRightGutterArea; property LeftGutterWidth: integer read FLeftGutterWidth write SetLeftGutterWidth; property RightGutterWidth: integer read FRightGutterWidth write SetRightGutterWidth; end; @@ -132,6 +136,20 @@ begin BoundsChanged; end; +procedure TLazSynSurfaceManager.SetLeftGutterArea(AValue: TLazSynSurface); +begin + if FLeftGutterArea = AValue then Exit; + FLeftGutterArea := AValue; + FLeftGutterArea.DisplayView := DisplayView; +end; + +procedure TLazSynSurfaceManager.SetRightGutterArea(AValue: TLazSynSurface); +begin + if FRightGutterArea = AValue then Exit; + FRightGutterArea := AValue; + FRightGutterArea.DisplayView := DisplayView; +end; + procedure TLazSynSurfaceManager.SetRightGutterWidth(AValue: integer); begin if FRightGutterWidth = AValue then Exit; @@ -139,6 +157,13 @@ begin BoundsChanged; end; +procedure TLazSynSurfaceManager.SetTextArea(AValue: TLazSynTextArea); +begin + if FTextArea = AValue then Exit; + FTextArea := AValue; + FTextArea.DisplayView := DisplayView; +end; + procedure TLazSynSurfaceManager.DoPaint(ACanvas: TCanvas; AClip: TRect); begin FLeftGutterArea.Paint(ACanvas, AClip); @@ -146,6 +171,13 @@ begin FRightGutterArea.Paint(ACanvas, AClip); end; +procedure TLazSynSurfaceManager.DoDisplayViewChanged; +begin + FLeftGutterArea.DisplayView := DisplayView; + FRightGutterArea.DisplayView := DisplayView; + FTextArea.DisplayView := DisplayView; +end; + procedure TLazSynSurfaceManager.BoundsChanged; var l, r: Integer; @@ -164,15 +196,21 @@ begin FRightGutterWidth := 0; end; -procedure TLazSynSurfaceManager.InvalidateLines(FirstLine, LastLine: TLineIdx); +procedure TLazSynSurfaceManager.InvalidateLines(FirstTextLine, LastTextLine: TLineIdx); var rcInval: TRect; begin rcInval := Bounds; - if (FirstLine >= 0) then - rcInval.Top := TextArea.TextBounds.Top + FirstLine * TextArea.LineHeight; - if (LastLine >= 0) then - rcInval.Bottom := TextArea.TextBounds.Top + LastLine * TextArea.LineHeight; + if (FirstTextLine >= 0) then + rcInval.Top := Max(TextArea.TextBounds.Top, + TextArea.TextBounds.Top + + (DisplayView.TextToViewIndex(FirstTextLine).Top + - TextArea.TopLine + 1) * TextArea.LineHeight); + if (LastTextLine >= 0) then + rcInval.Bottom := Min(TextArea.TextBounds.Bottom, + TextArea.TextBounds.Top + + (DisplayView.TextToViewIndex(LastTextLine).Bottom + - TextArea.TopLine + 2) * TextArea.LineHeight); {$IFDEF VerboseSynEditInvalidate} DebugLn(['TCustomSynEdit.InvalidateGutterLines ',DbgSName(self), ' FirstLine=',FirstLine, ' LastLine=',LastLine, ' rect=',dbgs(rcInval)]); @@ -181,6 +219,17 @@ begin InvalidateRect(Handle, @rcInval, FALSE); end; +procedure TLazSynSurfaceManager.InvalidateTextLines(FirstTextLine, LastTextLine: TLineIdx); +begin + FTextArea.InvalidateLines(FirstTextLine, LastTextLine); +end; + +procedure TLazSynSurfaceManager.InvalidateGutterLines(FirstTextLine, LastTextLine: TLineIdx); +begin + FLeftGutterArea.InvalidateLines(FirstTextLine, LastTextLine); + FRightGutterArea.InvalidateLines(FirstTextLine, LastTextLine); +end; + { TLazSynTextArea } function TLazSynTextArea.GetPadding(Side: TLazSynBorderSide): integer; @@ -308,7 +357,7 @@ begin FTextDrawer := TLazSynTextArea(Src).FTextDrawer; FTheLinesView := TLazSynTextArea(Src).FTheLinesView; - FDisplayView := TLazSynTextArea(Src).FDisplayView; + DisplayView := TLazSynTextArea(Src).DisplayView; FHighlighter := TLazSynTextArea(Src).FHighlighter; FMarkupManager := TLazSynTextArea(Src).FMarkupManager; FForegroundColor := TLazSynTextArea(Src).FForegroundColor; @@ -330,15 +379,21 @@ begin BoundsChanged; end; -procedure TLazSynTextArea.InvalidateLines(FirstLine, LastLine: TLineIdx); +procedure TLazSynTextArea.InvalidateLines(FirstTextLine, LastTextLine: TLineIdx); var rcInval: TRect; begin rcInval := Bounds; - if (FirstLine >= 0) then - rcInval.Top := TextBounds.Top + FirstLine * LineHeight; - if (LastLine >= 0) then - rcInval.Bottom := TextBounds.Top + LastLine * LineHeight; + if (FirstTextLine >= 0) then + rcInval.Top := Max(TextBounds.Top, + TextBounds.Top + + (DisplayView.TextToViewIndex(FirstTextLine).Top + - TopLine + 1) * LineHeight); + if (LastTextLine >= 0) then + rcInval.Bottom := Min(TextBounds.Bottom, + TextBounds.Top + + (DisplayView.TextToViewIndex(LastTextLine).Bottom + - TopLine + 2) * LineHeight); {$IFDEF VerboseSynEditInvalidate} DebugLn(['TCustomSynEdit.InvalidateGutterLines ',DbgSName(self), ' FirstLine=',FirstLine, ' LastLine=',LastLine, ' rect=',dbgs(rcInval)]); @@ -1021,7 +1076,7 @@ var TV := TopLine - 1; // Now loop through all the lines. The indices are valid for Lines. - MaxLine := FDisplayView.GetLinesCount-1; + MaxLine := DisplayView.GetLinesCount-1; CurLine := FirstLine-1; while CurLine clNone) and (nRightEdge >= FTextBounds.Left) then begin ypos := rcToken.Bottom - 1; @@ -1059,7 +1114,7 @@ var dec(rcToken.Bottom); end; - while FDisplayView.GetNextHighlighterToken(TokenInfo) do begin + while DisplayView.GetNextHighlighterToken(TokenInfo) do begin DrawHiLightMarkupToken(TokenInfo.TokenAttr, TokenInfo.TokenStart, TokenInfo.TokenLength); end; @@ -1122,14 +1177,14 @@ begin SetTokenAccuLength; end; - FDisplayView.InitHighlighterTokens(FHighlighter); + DisplayView.InitHighlighterTokens(FHighlighter); fTextDrawer.Style := []; //Font.Style; fTextDrawer.BeginDrawing(dc); try PaintLines; finally fTextDrawer.EndDrawing; - FDisplayView.FinishHighlighterTokens; + DisplayView.FinishHighlighterTokens; ReAllocMem(TokenAccu.p,0); end; end; diff --git a/components/synedit/synedit.pp b/components/synedit/synedit.pp index 4541930f8b..020286ceff 100644 --- a/components/synedit/synedit.pp +++ b/components/synedit/synedit.pp @@ -1909,7 +1909,6 @@ begin FTextArea.ExtraLineSpacing := 0; FTextArea.MarkupManager := fMarkupManager; FTextArea.TheLinesView := FTheLinesView; - FTextArea.DisplayView := FDisplayView; FTextArea.Highlighter := nil; FLeftGutterArea := TLazSynGutterArea.Create(Self); @@ -1924,6 +1923,7 @@ begin FPaintArea.TextArea := FTextArea; FPaintArea.LeftGutterArea := FLeftGutterArea; FPaintArea.RightGutterArea := FRightGutterArea; + FPaintArea.DisplayView := FDisplayView; Color := clWhite; Font.Assign(fFontDummy); @@ -2461,33 +2461,19 @@ end; procedure TCustomSynEdit.InvalidateGutterLines(FirstLine, LastLine: integer); // Todo: move to gutter var - rcInval: TRect; TopFoldLine: LongInt; begin if sfPainting in fStateFlags then exit; if Visible and HandleAllocated then if (FirstLine = -1) and (LastLine = -1) then begin - FLeftGutterArea.InvalidateLines(-1, -1); - FRightGutterArea.InvalidateLines(-1, -1); + FPaintArea.InvalidateGutterLines(-1, -1); end else begin // pretend we haven't scrolled TopFoldLine := FFoldedLinesView.TopLine; if FOldTopView <> TopView then FFoldedLinesView.TopLine := FOldTopView; - { find the visible lines first } - if LastLine >= 0 then begin - if (LastLine < FirstLine) then SwapInt(LastLine, FirstLine); - LastLine := RowToScreenRow(Min(LastLine, ScreenRowToRow(LinesInWindow)))+1; - LastLine := LastLine; - end - else - LastLine := LinesInWindow + 1; - FirstLine := RowToScreenRow(FirstLine); - FirstLine := Max(0, FirstLine); - - FLeftGutterArea.InvalidateLines(FirstLine, LastLine); - FRightGutterArea.InvalidateLines(FirstLine, LastLine); + FPaintArea.InvalidateGutterLines(FirstLine-1, LastLine-1); FFoldedLinesView.TopLine := TopFoldLine; end; @@ -2495,32 +2481,19 @@ end; procedure TCustomSynEdit.InvalidateLines(FirstLine, LastLine: integer); var - rcInval: TRect; - f, l: Integer; TopFoldLine: LongInt; begin if sfPainting in fStateFlags then exit; if Visible and HandleAllocated then if (FirstLine = -1) and (LastLine = -1) then begin - FTextArea.InvalidateLines(-1, -1); + FPaintArea.InvalidateTextLines(-1, -1); end else begin // pretend we haven't scrolled TopFoldLine := FFoldedLinesView.TopLine; if FOldTopView <> TopView then FFoldedLinesView.TopLine := FOldTopView; - { find the visible lines first } - if LastLine >= 0 then begin - if (LastLine < FirstLine) then SwapInt(LastLine, FirstLine); - l := RowToScreenRow(Min(LastLine, ScreenRowToRow(LinesInWindow)))+1; - l := l; - end - else - l := LinesInWindow + 1; - f := RowToScreenRow(FirstLine); - f := Max(0, f); - - FTextArea.InvalidateLines(F, L); + FPaintArea.InvalidateTextLines(FirstLine-1, LastLine-1); FFoldedLinesView.TopLine := TopFoldLine; end; diff --git a/components/synedit/syneditfoldedview.pp b/components/synedit/syneditfoldedview.pp index d6f7c1f0d6..f2b05689fc 100644 --- a/components/synedit/syneditfoldedview.pp +++ b/components/synedit/syneditfoldedview.pp @@ -332,6 +332,9 @@ type procedure SetHighlighterTokensLine(ALine: TLineIdx; out ARealLine: TLineIdx); override; function GetNextHighlighterToken(out ATokenInfo: TLazSynDisplayTokenInfo): Boolean; override; function GetLinesCount: Integer; override; + + function TextToViewIndex(AIndex: TLineIdx): TLineRange; override; + function ViewToTextIndex(AIndex: TLineIdx): TLineIdx; override; end; { TSynTextFoldedView @@ -716,6 +719,24 @@ begin Result := FFoldView.Count; end; +function TLazSynDisplayFold.TextToViewIndex(AIndex: TLineIdx): TLineRange; +begin + Result := inherited TextToViewIndex(AIndex); + if Result.Top = Result.Bottom then begin + Result.Top := FFoldView.TextIndexToViewPos(Result.Top) - 1; + Result.Bottom := Result.Top; + end + else begin; + Result.Top := FFoldView.TextIndexToViewPos(Result.Top) - 1; + Result.Bottom := FFoldView.TextIndexToViewPos(Result.Bottom) - 1; + end; +end; + +function TLazSynDisplayFold.ViewToTextIndex(AIndex: TLineIdx): TLineIdx; +begin + Result := FFoldView.ViewPosToTextIndex(inherited ViewToTextIndex(AIndex)+1); +end; + { TSynEditFoldExportStream } constructor TSynEditFoldExportStream.Create; diff --git a/components/synedit/syneditmiscclasses.pp b/components/synedit/syneditmiscclasses.pp index 809b7ae0e6..b84f4d2445 100644 --- a/components/synedit/syneditmiscclasses.pp +++ b/components/synedit/syneditmiscclasses.pp @@ -269,17 +269,20 @@ type TLazSynSurface = class private FBounds: TRect; + FDisplayView: TLazSynDisplayView; FOwner: TWinControl; function GetHandle: HWND; + procedure SetDisplayView(AValue: TLazSynDisplayView); protected procedure BoundsChanged; virtual; procedure DoPaint(ACanvas: TCanvas; AClip: TRect); virtual; abstract; + procedure DoDisplayViewChanged; virtual; property Handle: HWND read GetHandle; public constructor Create(AOwner: TWinControl); procedure Assign(Src: TLazSynSurface); virtual; procedure Paint(ACanvas: TCanvas; AClip: TRect); - procedure InvalidateLines(FirstLine, LastLine: TLineIdx); virtual; + procedure InvalidateLines(FirstTextLine, LastTextLine: TLineIdx); virtual; procedure SetBounds(ATop, ALeft, ABottom, ARight: Integer); property Left: Integer read FBounds.Left; @@ -287,6 +290,8 @@ type property Right:Integer read FBounds.Right; property Bottom: integer read FBounds.Bottom; property Bounds: TRect read FBounds; + + property DisplayView: TLazSynDisplayView read FDisplayView write SetDisplayView; end; { TSynBookMarkOpt } @@ -836,11 +841,23 @@ begin Result := FOwner.Handle; end; +procedure TLazSynSurface.SetDisplayView(AValue: TLazSynDisplayView); +begin + if FDisplayView = AValue then Exit; + FDisplayView := AValue; + DoDisplayViewChanged; +end; + procedure TLazSynSurface.BoundsChanged; begin // end; +procedure TLazSynSurface.DoDisplayViewChanged; +begin + // +end; + constructor TLazSynSurface.Create(AOwner: TWinControl); begin FOwner := AOwner; @@ -849,6 +866,7 @@ end; procedure TLazSynSurface.Assign(Src: TLazSynSurface); begin // do not assign the bounds + DisplayView := Src.DisplayView; end; procedure TLazSynSurface.Paint(ACanvas: TCanvas; AClip: TRect); @@ -868,7 +886,7 @@ begin DoPaint(ACanvas, AClip); end; -procedure TLazSynSurface.InvalidateLines(FirstLine, LastLine: TLineIdx); +procedure TLazSynSurface.InvalidateLines(FirstTextLine, LastTextLine: TLineIdx); begin // end; diff --git a/components/synedit/synedittextbuffer.pp b/components/synedit/synedittextbuffer.pp index 3d282a2038..5af2d680d2 100644 --- a/components/synedit/synedittextbuffer.pp +++ b/components/synedit/synedittextbuffer.pp @@ -122,6 +122,9 @@ type function GetNextHighlighterToken(out ATokenInfo: TLazSynDisplayTokenInfo): Boolean; override; function GetDrawDividerInfo: TSynDividerDrawConfigSetting; override; function GetLinesCount: Integer; override; + + function TextToViewIndex(AIndex: TLineIdx): TLineRange; override; + function ViewToTextIndex(AIndex: TLineIdx): TLineIdx; override; end; { TSynEditStringList } @@ -390,6 +393,17 @@ begin Result := FBuffer.Count; end; +function TLazSynDisplayBuffer.TextToViewIndex(AIndex: TLineIdx): TLineRange; +begin + Result.Top := AIndex; + Result.Bottom := AIndex; +end; + +function TLazSynDisplayBuffer.ViewToTextIndex(AIndex: TLineIdx): TLineIdx; +begin + Result := AIndex; +end; + { TSynEditUndoTxtInsert } function TSynEditUndoTxtInsert.DebugString: String; diff --git a/components/synedit/syngutter.pp b/components/synedit/syngutter.pp index 7d01f9d6e8..5c5b2c2522 100644 --- a/components/synedit/syngutter.pp +++ b/components/synedit/syngutter.pp @@ -103,7 +103,7 @@ type protected procedure DoPaint(ACanvas: TCanvas; AClip: TRect); override; public - procedure InvalidateLines(FirstLine, LastLine: TLineIdx); override; + procedure InvalidateLines(FirstTextLine, LastTextLine: TLineIdx); override; procedure Assign(Src: TLazSynSurface); override; property TextArea: TLazSynTextArea read FTextArea write FTextArea; property Gutter: TSynGutter read FGutter write FGutter; @@ -132,15 +132,21 @@ begin FGutter.Paint(ACanvas, Self, AClip, ScreenRow1, ScreenRow2); end; -procedure TLazSynGutterArea.InvalidateLines(FirstLine, LastLine: TLineIdx); +procedure TLazSynGutterArea.InvalidateLines(FirstTextLine, LastTextLine: TLineIdx); var rcInval: TRect; begin rcInval := Bounds; - if (FirstLine >= 0) then - rcInval.Top := TextArea.TextBounds.Top + FirstLine * TextArea.LineHeight; - if (LastLine >= 0) then - rcInval.Bottom := TextArea.TextBounds.Top + LastLine * TextArea.LineHeight; + if (FirstTextLine >= 0) then + rcInval.Top := Max(TextArea.TextBounds.Top, + TextArea.TextBounds.Top + + (DisplayView.TextToViewIndex(FirstTextLine).Top + - TextArea.TopLine + 1) * TextArea.LineHeight); + if (LastTextLine >= 0) then + rcInval.Bottom := Min(TextArea.TextBounds.Bottom, + TextArea.TextBounds.Top + + (DisplayView.TextToViewIndex(LastTextLine).Bottom + - TextArea.TopLine + 2) * TextArea.LineHeight); {$IFDEF VerboseSynEditInvalidate} DebugLn(['TCustomSynEdit.InvalidateGutterLines ',DbgSName(self), ' FirstLine=',FirstLine, ' LastLine=',LastLine, ' rect=',dbgs(rcInval)]); diff --git a/ide/sourcesyneditor.pas b/ide/sourcesyneditor.pas index 7fc940dd58..edefe6635d 100644 --- a/ide/sourcesyneditor.pas +++ b/ide/sourcesyneditor.pas @@ -64,6 +64,8 @@ type public procedure SetHighlighterTokensLine(ALine: TLineIdx; out ARealLine: TLineIdx); override; function GetLinesCount: Integer; override; + function TextToViewIndex(AIndex: TLineIdx): TLineRange; override; + function ViewToTextIndex(AIndex: TLineIdx): TLineIdx; override; public constructor Create; property LineMapCount: integer read FLineMapCount write SetLineMapCount; @@ -91,7 +93,9 @@ type public constructor Create(AOwner: TWinControl; AnOriginalManager: TLazSynSurfaceManager); destructor Destroy; override; - procedure InvalidateLines(FirstLine, LastLine: TLineIdx); override; + procedure InvalidateLines(FirstTextLine, LastTextLine: TLineIdx); override; + procedure InvalidateTextLines(FirstTextLine, LastTextLine: TLineIdx); override; + procedure InvalidateGutterLines(FirstTextLine, LastTextLine: TLineIdx); override; property ExtraManager: TLazSynSurfaceManager read FExtraManager write FExtraManager; property OriginalManager: TLazSynSurfaceManager read FOriginalManager write FOriginalManager; property TopLineCount: Integer read FTopLineCount write SetTopLineCount; @@ -386,6 +390,27 @@ begin Result := LineMapCount; end; +function TSourceLazSynTopInfoView.TextToViewIndex(AIndex: TLineIdx): TLineRange; +var + i: Integer; + r: TLineRange; +begin + Result.Top := -1; + Result.Bottom := -1; + r := inherited TextToViewIndex(AIndex); + for i := 0 to LineMapCount - 1 do begin + if LineMap[i] = r.Top then Result.Top := i; + if LineMap[i] = r.Bottom then Result.Bottom := i; + end; + if Result.Bottom < Result.Top then + Result.Bottom := Result.Top; +end; + +function TSourceLazSynTopInfoView.ViewToTextIndex(AIndex: TLineIdx): TLineIdx; +begin + Result := inherited ViewToTextIndex(AIndex); +end; + constructor TSourceLazSynTopInfoView.Create; begin LineMapCount := 0; @@ -468,9 +493,22 @@ begin FOriginalManager.Free; end; -procedure TSourceLazSynSurfaceManager.InvalidateLines(FirstLine, LastLine: TLineIdx); +procedure TSourceLazSynSurfaceManager.InvalidateLines(FirstTextLine, LastTextLine: TLineIdx); begin - FOriginalManager.InvalidateLines(FirstLine, LastLine); + FOriginalManager.InvalidateLines(FirstTextLine, LastTextLine); + FExtraManager.InvalidateLines(FirstTextLine, LastTextLine); +end; + +procedure TSourceLazSynSurfaceManager.InvalidateTextLines(FirstTextLine, LastTextLine: TLineIdx); +begin + FOriginalManager.InvalidateTextLines(FirstTextLine, LastTextLine); + FExtraManager.InvalidateTextLines(FirstTextLine, LastTextLine); +end; + +procedure TSourceLazSynSurfaceManager.InvalidateGutterLines(FirstTextLine, LastTextLine: TLineIdx); +begin + FOriginalManager.InvalidateGutterLines(FirstTextLine, LastTextLine); + FExtraManager.InvalidateGutterLines(FirstTextLine, LastTextLine); end; { TIDESynEditor } @@ -590,7 +628,7 @@ begin FTopInfoDisplay.NextView := ViewedTextBuffer.DisplayView; TSourceLazSynSurfaceManager(FPaintArea).TopLineCount := 0; TSourceLazSynSurfaceManager(FPaintArea).ExtraManager.TextArea.BackgroundColor := clSilver; - TSourceLazSynSurfaceManager(FPaintArea).ExtraManager.TextArea.DisplayView := FTopInfoDisplay; + TSourceLazSynSurfaceManager(FPaintArea).ExtraManager.DisplayView := FTopInfoDisplay; {$ENDIF} {$IFDEF WithSynDebugGutter} TIDESynGutter(RightGutter).DebugGutter.TheLinesView := ViewedTextBuffer;