mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-07 13:37:44 +01:00
SynEdit, Refactor: Separated the interface to Lines, from the TextBuffer implementation
git-svn-id: trunk@18846 -
This commit is contained in:
parent
83fb21fe1b
commit
b183a0ba51
@ -5,7 +5,7 @@ unit SynBeautifier;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, SynEditMiscClasses;
|
Classes, SysUtils, SynEditMiscClasses, SynEditTextBase;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TSynCustomBeautifier }
|
{ TSynCustomBeautifier }
|
||||||
@ -15,14 +15,16 @@ type
|
|||||||
function CanUnindent(const Editor: TSynEditBase; const Line: string;
|
function CanUnindent(const Editor: TSynEditBase; const Line: string;
|
||||||
const PhysCaretX: Integer): Boolean; virtual; abstract;
|
const PhysCaretX: Integer): Boolean; virtual; abstract;
|
||||||
function UnIndentLine(const Editor: TSynEditBase; const Line: string;
|
function UnIndentLine(const Editor: TSynEditBase; const Line: string;
|
||||||
const PhysCaret: TPoint; out DelChars, InsChars: String;
|
const Lines: TSynEditStrings; const PhysCaret: TPoint;
|
||||||
|
out DelChars, InsChars: String;
|
||||||
out CaretNewX: Integer): String; virtual; abstract; // Todo InsChar are not supprted for undo
|
out CaretNewX: Integer): String; virtual; abstract; // Todo InsChar are not supprted for undo
|
||||||
function IndentLine(const Editor: TSynEditBase; Line: string;
|
function IndentLine(const Editor: TSynEditBase; Line: string;
|
||||||
const PhysCaret: TPoint; out DelChars, InsChars: String;
|
const Lines: TSynEditStrings; const PhysCaret: TPoint;
|
||||||
out CaretNewX: Integer;
|
out DelChars, InsChars: String; out CaretNewX: Integer;
|
||||||
RemoveCurrentIndent: Boolean = False): String;
|
RemoveCurrentIndent: Boolean = False): String;
|
||||||
virtual; abstract; // Todo DelChar are not supprted for undo
|
virtual; abstract; // Todo DelChar are not supprted for undo
|
||||||
function GetIndentForLine(Editor: TSynEditBase; const Line: string;
|
function GetIndentForLine(Editor: TSynEditBase; const Line: string;
|
||||||
|
const Lines: TSynEditStrings;
|
||||||
const PhysCaret: TPoint): Integer; virtual; abstract;
|
const PhysCaret: TPoint): Integer; virtual; abstract;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -39,13 +41,15 @@ type
|
|||||||
function CanUnindent(const Editor: TSynEditBase; const Line: string;
|
function CanUnindent(const Editor: TSynEditBase; const Line: string;
|
||||||
const PhysCaretX: Integer): Boolean; override;
|
const PhysCaretX: Integer): Boolean; override;
|
||||||
function UnIndentLine(const Editor: TSynEditBase; const Line: string;
|
function UnIndentLine(const Editor: TSynEditBase; const Line: string;
|
||||||
const PhysCaret: TPoint; out DelChars, InsChars: String;
|
const Lines: TSynEditStrings; const PhysCaret: TPoint;
|
||||||
|
out DelChars, InsChars: String;
|
||||||
out CaretNewX: Integer): String; override; // Todo InsChar are not supprted for undo
|
out CaretNewX: Integer): String; override; // Todo InsChar are not supprted for undo
|
||||||
function IndentLine(const Editor: TSynEditBase; Line: string;
|
function IndentLine(const Editor: TSynEditBase; Line: string;
|
||||||
const PhysCaret: TPoint; out DelChars, InsChars: String;
|
const Lines: TSynEditStrings; const PhysCaret: TPoint;
|
||||||
out CaretNewX: Integer;
|
out DelChars, InsChars: String; out CaretNewX: Integer;
|
||||||
RemoveCurrentIndent: Boolean = False): String; override; // Todo DelChar are not supprted for undo
|
RemoveCurrentIndent: Boolean = False): String; override; // Todo DelChar are not supprted for undo
|
||||||
function GetIndentForLine(Editor: TSynEditBase; const Line: string;
|
function GetIndentForLine(Editor: TSynEditBase; const Line: string;
|
||||||
|
const Lines: TSynEditStrings;
|
||||||
const PhysCaret: TPoint): Integer; override;
|
const PhysCaret: TPoint): Integer; override;
|
||||||
published
|
published
|
||||||
property IndentType: TSynBeautifierIndentType read FIndentType write FIndentType;
|
property IndentType: TSynBeautifierIndentType read FIndentType write FIndentType;
|
||||||
@ -73,13 +77,16 @@ begin
|
|||||||
Result := 0;
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynBeautifier.CanUnindent(const Editor: TSynEditBase; const Line: string; const PhysCaretX: Integer): Boolean;
|
function TSynBeautifier.CanUnindent(const Editor: TSynEditBase;
|
||||||
|
const Line: string; const PhysCaretX: Integer): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (LeftSpaces(Editor, Line, True) = PhysCaretX - 1);
|
Result := (LeftSpaces(Editor, Line, True) = PhysCaretX - 1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynBeautifier.UnIndentLine(const Editor: TSynEditBase; const Line: string; const PhysCaret: TPoint; out DelChars, InsChars: String; out
|
function TSynBeautifier.UnIndentLine(const Editor: TSynEditBase;
|
||||||
CaretNewX: Integer): String;
|
// XXXXX viewed
|
||||||
|
const Line: string; const Lines: TSynEditStrings; const PhysCaret: TPoint;
|
||||||
|
out DelChars, InsChars: String; out CaretNewX: Integer): String;
|
||||||
var
|
var
|
||||||
SpaceCount1, SpaceCount2: Integer;
|
SpaceCount1, SpaceCount2: Integer;
|
||||||
BackCounter, LogSpacePos: Integer;
|
BackCounter, LogSpacePos: Integer;
|
||||||
@ -90,7 +97,7 @@ begin
|
|||||||
if (SpaceCount1 > 0) then begin
|
if (SpaceCount1 > 0) then begin
|
||||||
BackCounter := PhysCaret.Y - 2;
|
BackCounter := PhysCaret.Y - 2;
|
||||||
while BackCounter >= 0 do begin
|
while BackCounter >= 0 do begin
|
||||||
SpaceCount2 := LeftSpaces(Editor, Editor.RealLines[BackCounter], true);
|
SpaceCount2 := LeftSpaces(Editor, Lines[BackCounter], true);
|
||||||
if SpaceCount2 < SpaceCount1 then
|
if SpaceCount2 < SpaceCount1 then
|
||||||
break;
|
break;
|
||||||
Dec(BackCounter);
|
Dec(BackCounter);
|
||||||
@ -107,8 +114,10 @@ begin
|
|||||||
Result :=copy(Line, 1, LogSpacePos-1) + copy(Line, LogCaret.X, MaxInt);
|
Result :=copy(Line, 1, LogSpacePos-1) + copy(Line, LogCaret.X, MaxInt);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynBeautifier.IndentLine(const Editor: TSynEditBase; Line: string; const PhysCaret: TPoint; out DelChars, InsChars: String; out
|
function TSynBeautifier.IndentLine(const Editor: TSynEditBase; Line: string;
|
||||||
CaretNewX: Integer; RemoveCurrentIndent: Boolean): String;
|
// XXXXX viewed
|
||||||
|
const Lines: TSynEditStrings; const PhysCaret: TPoint; out DelChars,
|
||||||
|
InsChars: String; out CaretNewX: Integer; RemoveCurrentIndent: Boolean): String;
|
||||||
var
|
var
|
||||||
SpaceCount1, SpaceCount2: Integer;
|
SpaceCount1, SpaceCount2: Integer;
|
||||||
BackCounter: Integer;
|
BackCounter: Integer;
|
||||||
@ -126,7 +135,7 @@ begin
|
|||||||
if BackCounter > 0 then
|
if BackCounter > 0 then
|
||||||
repeat
|
repeat
|
||||||
Dec(BackCounter);
|
Dec(BackCounter);
|
||||||
Temp := Editor.RealLines[BackCounter];
|
Temp := Lines[BackCounter];
|
||||||
SpaceCount2 := LeftSpaces(Editor, Temp, True);
|
SpaceCount2 := LeftSpaces(Editor, Temp, True);
|
||||||
until (BackCounter = 0) or (Temp <> '');
|
until (BackCounter = 0) or (Temp <> '');
|
||||||
|
|
||||||
@ -146,11 +155,12 @@ begin
|
|||||||
CaretNewX := TSynEdit(Editor).LogicalToPhysicalCol(Result, PhysCaret.y - 1, SpaceCount2+1);
|
CaretNewX := TSynEdit(Editor).LogicalToPhysicalCol(Result, PhysCaret.y - 1, SpaceCount2+1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynBeautifier.GetIndentForLine(Editor: TSynEditBase; const Line: string; const PhysCaret: TPoint): Integer;
|
function TSynBeautifier.GetIndentForLine(Editor: TSynEditBase;
|
||||||
|
const Line: string; const Lines: TSynEditStrings; const PhysCaret: TPoint): Integer;
|
||||||
var
|
var
|
||||||
s1, s2: string;
|
s1, s2: string;
|
||||||
begin
|
begin
|
||||||
IndentLine(Editor, Line, PhysCaret, s1, s2, Result, False);
|
IndentLine(Editor, Line, Lines, PhysCaret, s1, s2, Result, False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
@ -45,7 +45,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLProc, SynEdit, SynBeautifier, SynEditTextBuffer,
|
Classes, SysUtils, LCLProc, SynEdit, SynBeautifier, SynEditTextBuffer,
|
||||||
SynEditHighlighter, SynHighlighterPas;
|
SynEditHighlighter, SynHighlighterPas, SynEditTextBase;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -54,18 +54,19 @@ type
|
|||||||
TSynBeautifierPas = class(TSynBeautifier)
|
TSynBeautifierPas = class(TSynBeautifier)
|
||||||
public
|
public
|
||||||
function TokenKindIsComment(Kind: integer): boolean;
|
function TokenKindIsComment(Kind: integer): boolean;
|
||||||
function InComment(Editor: TCustomSynEdit; XY: TPoint): boolean;
|
function InComment(Editor: TCustomSynEdit; Lines: TSynEditStrings;
|
||||||
procedure ReadPriorToken(Editor: TCustomSynEdit; var Y, StartX, EndX: integer);
|
XY: TPoint): boolean;
|
||||||
|
procedure ReadPriorToken(Editor: TCustomSynEdit; Lines: TSynEditStrings;
|
||||||
|
var Y, StartX, EndX: integer);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ TSynBeautifierPas }
|
{ TSynBeautifierPas }
|
||||||
|
|
||||||
procedure TSynBeautifierPas.ReadPriorToken(Editor: TCustomSynEdit; var Y,
|
procedure TSynBeautifierPas.ReadPriorToken(Editor: TCustomSynEdit;
|
||||||
StartX, EndX: integer);
|
Lines: TSynEditStrings; var Y, StartX, EndX: integer);
|
||||||
var
|
var
|
||||||
Lines: TSynEditStringList;
|
|
||||||
TokenStart: Integer;
|
TokenStart: Integer;
|
||||||
Line: string;
|
Line: string;
|
||||||
Highlighter: TSynCustomHighlighter;
|
Highlighter: TSynCustomHighlighter;
|
||||||
@ -77,7 +78,6 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Lines:=TSynEditStringList(Editor.Lines);
|
|
||||||
if Y>Lines.Count then begin
|
if Y>Lines.Count then begin
|
||||||
// cursor after end of code
|
// cursor after end of code
|
||||||
// => move to end of last line
|
// => move to end of last line
|
||||||
@ -120,11 +120,10 @@ begin
|
|||||||
Result:=(ord(tkComment)=Kind) or (ord(tkDirective)=Kind);
|
Result:=(ord(tkComment)=Kind) or (ord(tkDirective)=Kind);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynBeautifierPas.InComment(Editor: TCustomSynEdit; XY: TPoint
|
function TSynBeautifierPas.InComment(Editor: TCustomSynEdit;
|
||||||
): boolean;
|
Lines: TSynEditStrings; XY: TPoint): boolean;
|
||||||
var
|
var
|
||||||
Highlighter: TSynPasSyn;
|
Highlighter: TSynPasSyn;
|
||||||
Lines: TSynEditStringList;
|
|
||||||
Line: string;
|
Line: string;
|
||||||
Start: Integer;
|
Start: Integer;
|
||||||
Token: String;
|
Token: String;
|
||||||
@ -137,7 +136,6 @@ begin
|
|||||||
exit(false);
|
exit(false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Lines:=TSynEditStringList(Editor.Lines);
|
|
||||||
if Lines.Count=0 then begin
|
if Lines.Count=0 then begin
|
||||||
DebugLn(['TSynBeautifierPas.InComment Lines empty']);
|
DebugLn(['TSynBeautifierPas.InComment Lines empty']);
|
||||||
exit(false); // no code
|
exit(false); // no code
|
||||||
|
|||||||
@ -84,6 +84,7 @@ uses
|
|||||||
SynGutterLineNumber, SynGutterMarks,
|
SynGutterLineNumber, SynGutterMarks,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
SynEditMiscClasses, SynEditTextBuffer, SynEditHighlighter, SynTextDrawer,
|
SynEditMiscClasses, SynEditTextBuffer, SynEditHighlighter, SynTextDrawer,
|
||||||
|
SynEditLines,
|
||||||
LResources;
|
LResources;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -355,8 +356,9 @@ type
|
|||||||
FTrimmedLinesView: TSynEditStringTrimmingList;
|
FTrimmedLinesView: TSynEditStringTrimmingList;
|
||||||
FDoubleWidthChrLinesView: SynEditStringDoubleWidthChars;
|
FDoubleWidthChrLinesView: SynEditStringDoubleWidthChars;
|
||||||
FTabbedLinesView: TSynEditStringTabExpander;
|
FTabbedLinesView: TSynEditStringTabExpander;
|
||||||
FTheLinesView: TStrings;
|
FTheLinesView: TSynEditStrings;
|
||||||
fLines: TStrings; // The real (un-mapped) line-buffer
|
FLines: TSynEditStrings; // The real (un-mapped) line-buffer
|
||||||
|
FStrings: TStrings; // External TStrings based interface to the Textbuffer
|
||||||
fLinesInWindow: Integer;// MG: fully visible lines in window
|
fLinesInWindow: Integer;// MG: fully visible lines in window
|
||||||
fLeftChar: Integer; // first visible screen column
|
fLeftChar: Integer; // first visible screen column
|
||||||
fMaxLeftChar: Integer; // 1024
|
fMaxLeftChar: Integer; // 1024
|
||||||
@ -449,6 +451,7 @@ type
|
|||||||
function GetCanUndo: Boolean;
|
function GetCanUndo: Boolean;
|
||||||
function GetCaretXY: TPoint;
|
function GetCaretXY: TPoint;
|
||||||
function GetFoldedCodeColor: TSynSelectedColor;
|
function GetFoldedCodeColor: TSynSelectedColor;
|
||||||
|
function GetLines: TStrings; override;
|
||||||
function GetMarkup(Index: integer): TSynEditMarkup;
|
function GetMarkup(Index: integer): TSynEditMarkup;
|
||||||
function GetMarkupByClass(Index: TSynEditMarkupClass): TSynEditMarkup;
|
function GetMarkupByClass(Index: TSynEditMarkupClass): TSynEditMarkup;
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
@ -582,9 +585,8 @@ type
|
|||||||
procedure RealSetText(const Value: TCaption); override;
|
procedure RealSetText(const Value: TCaption); override;
|
||||||
procedure IncreaseChangeStamp;
|
procedure IncreaseChangeStamp;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
procedure SetRealLines(const AValue : TStrings); override;
|
function GetViewedTextBuffer: TSynEditStrings; override;
|
||||||
function GetTheLinesView: TStrings; override;
|
function GetTextBuffer: TSynEditStrings; override;
|
||||||
function GetLines: TStrings; override;
|
|
||||||
procedure SetLines(Value: TStrings); override;
|
procedure SetLines(Value: TStrings); override;
|
||||||
procedure DecPaintLock;
|
procedure DecPaintLock;
|
||||||
procedure DestroyWnd; override;
|
procedure DestroyWnd; override;
|
||||||
@ -1376,25 +1378,24 @@ begin
|
|||||||
FInternalCaret.MaxLeftChar := @FMaxLeftChar;
|
FInternalCaret.MaxLeftChar := @FMaxLeftChar;
|
||||||
|
|
||||||
// Create the lines/views
|
// Create the lines/views
|
||||||
FTrimmedLinesView := TSynEditStringTrimmingList.Create
|
FTrimmedLinesView := TSynEditStringTrimmingList.Create(fLines, fCaret);
|
||||||
(TSynEditStrings(fLines), fCaret);
|
|
||||||
|
|
||||||
FDoubleWidthChrLinesView := SynEditStringDoubleWidthChars.Create
|
FDoubleWidthChrLinesView := SynEditStringDoubleWidthChars.Create
|
||||||
(TSynEditStrings(FTrimmedLinesView));
|
(FTrimmedLinesView);
|
||||||
|
|
||||||
FTabbedLinesView := TSynEditStringTabExpander.Create
|
FTabbedLinesView := TSynEditStringTabExpander.Create(FDoubleWidthChrLinesView);
|
||||||
(TSynEditStrings(FDoubleWidthChrLinesView));
|
|
||||||
|
|
||||||
FFoldedLinesView := TSynEditFoldedView.Create
|
FFoldedLinesView := TSynEditFoldedView.Create(FTabbedLinesView, fCaret);
|
||||||
(TSynEditStrings(FTabbedLinesView), fCaret);
|
|
||||||
FFoldedLinesView.OnFoldChanged := {$IFDEF FPC}@{$ENDIF}FoldChanged;
|
FFoldedLinesView.OnFoldChanged := {$IFDEF FPC}@{$ENDIF}FoldChanged;
|
||||||
|
|
||||||
// Pointer to the First/Lowest View
|
// Pointer to the First/Lowest View
|
||||||
// TODO: this should be Folded...
|
// TODO: this should be Folded...
|
||||||
FTheLinesView := FTabbedLinesView;
|
FTheLinesView := FTabbedLinesView;
|
||||||
|
// External Accessor
|
||||||
|
FStrings := TSynEditLines.Create(FLines, {$IFDEF FPC}@{$ENDIF}MarkTextAsSaved);
|
||||||
|
|
||||||
FCaret.Lines := TSynEditStrings(FTheLinesView);
|
FCaret.Lines := FTheLinesView;
|
||||||
FInternalCaret.Lines := TSynEditStrings(FTheLinesView);
|
FInternalCaret.Lines := FTheLinesView;
|
||||||
|
|
||||||
TSynEditStringList(fLines).AddChangeHandler(senrLineCount,
|
TSynEditStringList(fLines).AddChangeHandler(senrLineCount,
|
||||||
{$IFDEF FPC}@{$ENDIF}LineCountChanged);
|
{$IFDEF FPC}@{$ENDIF}LineCountChanged);
|
||||||
@ -1414,7 +1415,7 @@ begin
|
|||||||
|
|
||||||
FTrimmedLinesView.UndoList := fUndoList;
|
FTrimmedLinesView.UndoList := fUndoList;
|
||||||
|
|
||||||
FBlockSelection := TSynEditSelection.Create(TSynEditStrings(FTheLinesView));
|
FBlockSelection := TSynEditSelection.Create(FTheLinesView);
|
||||||
FBlockSelection.MaxLeftChar := @FMaxLeftChar;
|
FBlockSelection.MaxLeftChar := @FMaxLeftChar;
|
||||||
FBlockSelection.Caret := FCaret;
|
FBlockSelection.Caret := FCaret;
|
||||||
FBlockSelection.UndoList := fUndoList;
|
FBlockSelection.UndoList := fUndoList;
|
||||||
@ -1467,7 +1468,7 @@ begin
|
|||||||
fMarkupManager.AddMarkUp(fMarkupBracket);
|
fMarkupManager.AddMarkUp(fMarkupBracket);
|
||||||
fMarkupManager.AddMarkUp(fMarkupWordGroup);
|
fMarkupManager.AddMarkUp(fMarkupWordGroup);
|
||||||
fMarkupManager.AddMarkUp(fMarkupSelection);
|
fMarkupManager.AddMarkUp(fMarkupSelection);
|
||||||
fMarkupManager.Lines := TSynEditStrings(FTheLinesView);
|
fMarkupManager.Lines := FTheLinesView;
|
||||||
fMarkupManager.InvalidateLinesMethod := @InvalidateLines;
|
fMarkupManager.InvalidateLinesMethod := @InvalidateLines;
|
||||||
|
|
||||||
Color := clWhite;
|
Color := clWhite;
|
||||||
@ -1649,6 +1650,7 @@ begin
|
|||||||
fTextDrawer.Free;
|
fTextDrawer.Free;
|
||||||
fFontDummy.Free;
|
fFontDummy.Free;
|
||||||
fBlockSelection.Free;
|
fBlockSelection.Free;
|
||||||
|
FStrings.Free;
|
||||||
FTabbedLinesView.Free;
|
FTabbedLinesView.Free;
|
||||||
FTrimmedLinesView.Free;
|
FTrimmedLinesView.Free;
|
||||||
FDoubleWidthChrLinesView.Free;
|
FDoubleWidthChrLinesView.Free;
|
||||||
@ -1671,6 +1673,7 @@ begin
|
|||||||
FreeAndNil(fFontDummy);
|
FreeAndNil(fFontDummy);
|
||||||
FreeAndNil(FFoldedLinesView);
|
FreeAndNil(FFoldedLinesView);
|
||||||
FreeAndNil(fBlockSelection);
|
FreeAndNil(fBlockSelection);
|
||||||
|
FreeAndNil(FStrings);
|
||||||
FreeAndNil(FTabbedLinesView);
|
FreeAndNil(FTabbedLinesView);
|
||||||
FreeAndNil(FTrimmedLinesView);
|
FreeAndNil(FTrimmedLinesView);
|
||||||
FreeAndNil(FDoubleWidthChrLinesView);
|
FreeAndNil(FDoubleWidthChrLinesView);
|
||||||
@ -1715,7 +1718,7 @@ begin
|
|||||||
SizeOrFontChanged(TRUE);
|
SizeOrFontChanged(TRUE);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomSynEdit.GetLines: TStrings;
|
function TCustomSynEdit.GetTextBuffer: TSynEditStrings;
|
||||||
begin
|
begin
|
||||||
Result := FLines;
|
Result := FLines;
|
||||||
end;
|
end;
|
||||||
@ -1788,7 +1791,7 @@ begin
|
|||||||
Result := FTrimmedLinesView.TrimType;
|
Result := FTrimmedLinesView.TrimType;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomSynEdit.GetTheLinesView: TStrings;
|
function TCustomSynEdit.GetViewedTextBuffer: TSynEditStrings;
|
||||||
begin
|
begin
|
||||||
Result := FTheLinesView;
|
Result := FTheLinesView;
|
||||||
end;
|
end;
|
||||||
@ -1804,12 +1807,6 @@ begin
|
|||||||
fGutter.OnGutterClick := AValue;
|
fGutter.OnGutterClick := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.SetRealLines(const AValue : TStrings);
|
|
||||||
begin
|
|
||||||
if HandleAllocated then
|
|
||||||
FTheLinesView.Assign(AValue);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCustomSynEdit.SetUseIncrementalColor(const AValue : Boolean);
|
procedure TCustomSynEdit.SetUseIncrementalColor(const AValue : Boolean);
|
||||||
begin
|
begin
|
||||||
fMarkupSelection.UseIncrementalColor:=AValue;
|
fMarkupSelection.UseIncrementalColor:=AValue;
|
||||||
@ -3590,6 +3587,11 @@ begin
|
|||||||
Result := FFoldedLinesView.MarkupInfoFoldedCode;
|
Result := FFoldedLinesView.MarkupInfoFoldedCode;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomSynEdit.GetLines: TStrings;
|
||||||
|
begin
|
||||||
|
Result := FStrings;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.SetCaretXY(Value: TPoint);
|
procedure TCustomSynEdit.SetCaretXY(Value: TPoint);
|
||||||
// physical position (screen)
|
// physical position (screen)
|
||||||
begin
|
begin
|
||||||
@ -3621,7 +3623,7 @@ begin
|
|||||||
if eoScrollPastEol in Options then
|
if eoScrollPastEol in Options then
|
||||||
MaxVal := fMaxLeftChar
|
MaxVal := fMaxLeftChar
|
||||||
else
|
else
|
||||||
MaxVal := TSynEditStrings(FTheLinesView).LengthOfLongestLine;
|
MaxVal := FTheLinesView.LengthOfLongestLine;
|
||||||
Value := Min(Value, MaxVal - fCharsInWindow + 1);
|
Value := Min(Value, MaxVal - fCharsInWindow + 1);
|
||||||
{end} //mh 2000-10-19
|
{end} //mh 2000-10-19
|
||||||
Value := Max(Value, 1);
|
Value := Max(Value, 1);
|
||||||
@ -3637,7 +3639,7 @@ end;
|
|||||||
procedure TCustomSynEdit.SetLines(Value: TStrings);
|
procedure TCustomSynEdit.SetLines(Value: TStrings);
|
||||||
begin
|
begin
|
||||||
if HandleAllocated then
|
if HandleAllocated then
|
||||||
FLines.Assign(Value);
|
FStrings.Assign(Value);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.SetLineText(Value: string);
|
procedure TCustomSynEdit.SetLineText(Value: string);
|
||||||
@ -3909,17 +3911,10 @@ begin
|
|||||||
ScrollInfo.nMin := 1;
|
ScrollInfo.nMin := 1;
|
||||||
ScrollInfo.nTrackPos := 0;
|
ScrollInfo.nTrackPos := 0;
|
||||||
if fScrollBars in [ssBoth, ssHorizontal] then begin
|
if fScrollBars in [ssBoth, ssHorizontal] then begin
|
||||||
{begin} //mh 2000-10-19
|
|
||||||
// ScrollInfo.nMax := fMaxLeftChar;
|
|
||||||
if eoScrollPastEol in Options then
|
if eoScrollPastEol in Options then
|
||||||
ScrollInfo.nMax := fMaxLeftChar
|
ScrollInfo.nMax := fMaxLeftChar
|
||||||
else
|
else
|
||||||
{$IFDEF SYN_LAZARUS}
|
ScrollInfo.nMax := FTheLinesView.LengthOfLongestLine;
|
||||||
ScrollInfo.nMax := TSynEditStrings(FTheLinesView).LengthOfLongestLine;
|
|
||||||
{$ELSE}
|
|
||||||
ScrollInfo.nMax := TSynEditStringList(Lines).LengthOfLongestLine;
|
|
||||||
{$ENDIF}
|
|
||||||
{end} //mh 2000-10-19
|
|
||||||
ScrollInfo.nPage := CharsInWindow;
|
ScrollInfo.nPage := CharsInWindow;
|
||||||
ScrollInfo.nPos := LeftChar;
|
ScrollInfo.nPos := LeftChar;
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
@ -4234,10 +4229,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
FixFStart := Index;
|
FixFStart := Index;
|
||||||
if Result > 0 then
|
if Result > 0 then
|
||||||
fHighlighter.SetRange(TSynEditStrings(FTheLinesView).Ranges[Result])
|
fHighlighter.SetRange(FTheLinesView.Ranges[Result])
|
||||||
else begin
|
else begin
|
||||||
fHighlighter.ReSetRange;
|
fHighlighter.ReSetRange;
|
||||||
TSynEditStrings(FTheLinesView).Ranges[0] := fHighlighter.GetRange;
|
FTheLinesView.Ranges[0] := fHighlighter.GetRange;
|
||||||
end;
|
end;
|
||||||
if Index >= FTheLinesView.Count - 1 then begin
|
if Index >= FTheLinesView.Count - 1 then begin
|
||||||
FFoldedLinesView.FixFoldingAtTextIndex(Index);
|
FFoldedLinesView.FixFoldingAtTextIndex(Index);
|
||||||
@ -4251,18 +4246,18 @@ begin
|
|||||||
fHighlighter.NextToEol;
|
fHighlighter.NextToEol;
|
||||||
LastLineDiffers := True;
|
LastLineDiffers := True;
|
||||||
SkipPrev := True;
|
SkipPrev := True;
|
||||||
while (fHighlighter.GetRange <> TSynEditStrings(FTheLinesView).Ranges[Result])
|
while (fHighlighter.GetRange <> FTheLinesView.Ranges[Result])
|
||||||
or (fHighlighter.LastLineCodeFoldLevelFix <> 0)
|
or (fHighlighter.LastLineCodeFoldLevelFix <> 0)
|
||||||
or (FFoldedLinesView.FoldMinLevel[Result-1] <> fHighlighter.MinimumCodeFoldBlockLevel)
|
or (FFoldedLinesView.FoldMinLevel[Result-1] <> fHighlighter.MinimumCodeFoldBlockLevel)
|
||||||
or (FFoldedLinesView.FoldEndLevel[Result-1] <> fHighlighter.CurrentCodeFoldBlockLevel)
|
or (FFoldedLinesView.FoldEndLevel[Result-1] <> fHighlighter.CurrentCodeFoldBlockLevel)
|
||||||
or LastLineDiffers or (Result<=AtLeastTilIndex+1)
|
or LastLineDiffers or (Result<=AtLeastTilIndex+1)
|
||||||
do begin
|
do begin
|
||||||
//debugln(['TSynCustomHighlighter.ScanFrom WHILE Y=',Result,' Level=',fHighlighter.CurrentCodeFoldBlockLevel,' ScannedLine="',Lines[Result-1],'"']);
|
//debugln(['TSynCustomHighlighter.ScanFrom WHILE Y=',Result,' Level=',fHighlighter.CurrentCodeFoldBlockLevel,' ScannedLine="',Lines[Result-1],'"']);
|
||||||
LastLineDiffers := (fHighlighter.GetRange <> TSynEditStrings(FTheLinesView).Ranges[Result])
|
LastLineDiffers := (fHighlighter.GetRange <> FTheLinesView.Ranges[Result])
|
||||||
or (fHighlighter.LastLineCodeFoldLevelFix <> 0)
|
or (fHighlighter.LastLineCodeFoldLevelFix <> 0)
|
||||||
or (FFoldedLinesView.FoldMinLevel[Result-1] <> fHighlighter.MinimumCodeFoldBlockLevel)
|
or (FFoldedLinesView.FoldMinLevel[Result-1] <> fHighlighter.MinimumCodeFoldBlockLevel)
|
||||||
or (FFoldedLinesView.FoldEndLevel[Result-1] <> fHighlighter.CurrentCodeFoldBlockLevel);
|
or (FFoldedLinesView.FoldEndLevel[Result-1] <> fHighlighter.CurrentCodeFoldBlockLevel);
|
||||||
TSynEditStrings(FTheLinesView).Ranges[Result] := fHighlighter.GetRange;
|
FTheLinesView.Ranges[Result] := fHighlighter.GetRange;
|
||||||
SetCodeFoldAttributes;
|
SetCodeFoldAttributes;
|
||||||
SkipPrev := False;
|
SkipPrev := False;
|
||||||
//if (Result and $fff)=0 then
|
//if (Result and $fff)=0 then
|
||||||
@ -4287,7 +4282,6 @@ begin
|
|||||||
Dec(Result);
|
Dec(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Called with (0, 0) => to invalidate all lines => redraw
|
|
||||||
procedure TCustomSynEdit.LineCountChanged(Sender: TSynEditStrings; AIndex, ACount: Integer);
|
procedure TCustomSynEdit.LineCountChanged(Sender: TSynEditStrings; AIndex, ACount: Integer);
|
||||||
begin
|
begin
|
||||||
ScanFrom(AIndex - 1, Min(AIndex, AIndex + ACount));
|
ScanFrom(AIndex - 1, Min(AIndex, AIndex + ACount));
|
||||||
@ -4382,7 +4376,7 @@ begin
|
|||||||
*)
|
*)
|
||||||
i := 0;
|
i := 0;
|
||||||
repeat
|
repeat
|
||||||
TSynEditStrings(FTheLinesView).Ranges[i] := fHighlighter.GetRange;
|
FTheLinesView.Ranges[i] := fHighlighter.GetRange;
|
||||||
fHighlighter.SetLine(Lines[i], i);
|
fHighlighter.SetLine(Lines[i], i);
|
||||||
fHighlighter.NextToEol;
|
fHighlighter.NextToEol;
|
||||||
Inc(i);
|
Inc(i);
|
||||||
@ -4593,7 +4587,7 @@ begin
|
|||||||
FBlockSelection.EndLineBytePos := Runner;
|
FBlockSelection.EndLineBytePos := Runner;
|
||||||
FBlockSelection.ActiveSelectionMode := smNormal;
|
FBlockSelection.ActiveSelectionMode := smNormal;
|
||||||
// set caret to the end of selected block
|
// set caret to the end of selected block
|
||||||
CaretXY := TSynEditStrings(FTheLinesView).LogicalToPhysicalPos(Runner);
|
CaretXY := FTheLinesView.LogicalToPhysicalPos(Runner);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -4619,7 +4613,7 @@ begin
|
|||||||
FBlockSelection.EndLineBytePos := Point(x2, MinMax(Value.y, 1, FTheLinesView.Count));
|
FBlockSelection.EndLineBytePos := Point(x2, MinMax(Value.y, 1, FTheLinesView.Count));
|
||||||
end;
|
end;
|
||||||
FBlockSelection.ActiveSelectionMode := smNormal;
|
FBlockSelection.ActiveSelectionMode := smNormal;
|
||||||
CaretXY := TSynEditStrings(FTheLinesView).LogicalToPhysicalPos(FBlockSelection.EndLineBytePos);
|
CaretXY := FTheLinesView.LogicalToPhysicalPos(FBlockSelection.EndLineBytePos);
|
||||||
//DebugLn(' FFF2 ',Value.X,',',Value.Y,' BlockBegin=',BlockBegin.X,',',BlockBegin.Y,' BlockEnd=',BlockEnd.X,',',BlockEnd.Y);
|
//DebugLn(' FFF2 ',Value.X,',',Value.Y,' BlockBegin=',BlockBegin.X,',',BlockBegin.Y,' BlockEnd=',BlockEnd.X,',',BlockEnd.Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -5486,7 +5480,7 @@ begin
|
|||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
if fHighlighter<>nil then begin
|
if fHighlighter<>nil then begin
|
||||||
fHighlighter.ResetRange;
|
fHighlighter.ResetRange;
|
||||||
TSynEditStrings(FTheLinesView).ClearRanges(fHighlighter.GetRange);
|
FTheLinesView.ClearRanges(fHighlighter.GetRange);
|
||||||
fTSearch.IdentChars:=fHighlighter.IdentChars;
|
fTSearch.IdentChars:=fHighlighter.IdentChars;
|
||||||
end else begin
|
end else begin
|
||||||
fTSearch.ResetIdentChars;
|
fTSearch.ResetIdentChars;
|
||||||
@ -6035,8 +6029,8 @@ begin
|
|||||||
FBeautifier.CanUnindent(Self, Temp, CaretX) then
|
FBeautifier.CanUnindent(Self, Temp, CaretX) then
|
||||||
begin
|
begin
|
||||||
// unindent
|
// unindent
|
||||||
Temp := FBeautifier.UnIndentLine(Self, Temp, CaretXY,
|
Temp := FBeautifier.UnIndentLine(Self, Temp, ViewedTextBuffer,
|
||||||
Helper, Temp2, CX); // TODO: Temp2 must be added as crInsert to undolist
|
CaretXY, Helper, Temp2, CX); // TODO: Temp2 must be added as crInsert to undolist
|
||||||
FTheLinesView[CaretY - 1] := Temp;
|
FTheLinesView[CaretY - 1] := Temp;
|
||||||
CaretX := CX;
|
CaretX := CX;
|
||||||
fLastCaretX := CaretX;
|
fLastCaretX := CaretX;
|
||||||
@ -6273,8 +6267,8 @@ begin
|
|||||||
if (eoAutoIndent in fOptions) then begin
|
if (eoAutoIndent in fOptions) then begin
|
||||||
Caret := CaretXY;
|
Caret := CaretXY;
|
||||||
Caret.Y := Caret.Y + 1;
|
Caret.Y := Caret.Y + 1;
|
||||||
Temp2 := FBeautifier.IndentLine(Self, Temp2, Caret, Helper,
|
Temp2 := FBeautifier.IndentLine(Self, Temp2, ViewedTextBuffer,
|
||||||
Temp, CX, False);
|
Caret, Helper, Temp, CX, False);
|
||||||
end else
|
end else
|
||||||
CX := 1;
|
CX := 1;
|
||||||
FTheLinesView[CaretY] := Temp2;
|
FTheLinesView[CaretY] := Temp2;
|
||||||
@ -6303,8 +6297,8 @@ begin
|
|||||||
if (eoAutoIndent in fOptions) then begin
|
if (eoAutoIndent in fOptions) then begin
|
||||||
Caret := CaretXY;
|
Caret := CaretXY;
|
||||||
Caret.Y := Caret.Y + 1;
|
Caret.Y := Caret.Y + 1;
|
||||||
Temp2 := FBeautifier.IndentLine(Self, Temp2, Caret, Helper,
|
Temp2 := FBeautifier.IndentLine(Self, Temp2, ViewedTextBuffer,
|
||||||
Temp, CX, False);
|
Caret, Helper, Temp, CX, False);
|
||||||
end else
|
end else
|
||||||
CX := 1;
|
CX := 1;
|
||||||
FTheLinesView.Insert(CaretY, Temp);
|
FTheLinesView.Insert(CaretY, Temp);
|
||||||
@ -6655,7 +6649,7 @@ begin
|
|||||||
FindFirstNonWhiteSpaceCharInNextLine;
|
FindFirstNonWhiteSpaceCharInNextLine;
|
||||||
end else begin
|
end else begin
|
||||||
if fHighlighter<>nil then begin
|
if fHighlighter<>nil then begin
|
||||||
fHighlighter.SetRange(TSynEditStrings(FTheLinesView).Ranges[CY - 1]);
|
fHighlighter.SetRange(FTheLinesView.Ranges[CY - 1]);
|
||||||
fHighlighter.SetLine(Line, CY - 1);
|
fHighlighter.SetLine(Line, CY - 1);
|
||||||
while not fHighlighter.GetEol do begin
|
while not fHighlighter.GetEol do begin
|
||||||
nTokenPos := fHighlighter.GetTokenPos; // zero-based
|
nTokenPos := fHighlighter.GetTokenPos; // zero-based
|
||||||
@ -7874,7 +7868,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
FUseUTF8:=fTextDrawer.UseUTF8;
|
FUseUTF8:=fTextDrawer.UseUTF8;
|
||||||
TSynEditStrings(fLines).IsUtf8 := FUseUTF8;
|
FLines.IsUtf8 := FUseUTF8;
|
||||||
//debugln('TCustomSynEdit.RecalcCharExtent UseUTF8=',dbgs(UseUTF8),' Font.CanUTF8=',dbgs(Font.CanUTF8));
|
//debugln('TCustomSynEdit.RecalcCharExtent UseUTF8=',dbgs(UseUTF8),' Font.CanUTF8=',dbgs(Font.CanUTF8));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
GutterChanged(Self);
|
GutterChanged(Self);
|
||||||
@ -8285,7 +8279,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
// this line is blank
|
// this line is blank
|
||||||
// -> use automatic line indent
|
// -> use automatic line indent
|
||||||
LineStart := FBeautifier.GetIndentForLine(Self, FTheLinesView[CaretY-1], CaretXY);
|
LineStart := FBeautifier.GetIndentForLine(Self, FTheLinesView[CaretY-1], FTheLinesView, CaretXY);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
NewPos.X:=LineStart;
|
NewPos.X:=LineStart;
|
||||||
@ -8332,7 +8326,7 @@ begin
|
|||||||
end else begin
|
end else begin
|
||||||
// this line is blank
|
// this line is blank
|
||||||
// -> use automatic line indent
|
// -> use automatic line indent
|
||||||
LineEnd := FBeautifier.GetIndentForLine(Self, FTheLinesView[CaretY-1], CaretXY);
|
LineEnd := FBeautifier.GetIndentForLine(Self, FTheLinesView[CaretY-1], FTheLinesView, CaretXY);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
NewPos.X:=LineEnd;
|
NewPos.X:=LineEnd;
|
||||||
@ -8583,7 +8577,7 @@ var
|
|||||||
end;
|
end;
|
||||||
// Init the Highlighter only once per line
|
// Init the Highlighter only once per line
|
||||||
if MaxKnownTokenPos < 1 then begin
|
if MaxKnownTokenPos < 1 then begin
|
||||||
fHighlighter.SetRange(TSynEditStrings(FTheLinesView).Ranges[PosY - 1]);
|
fHighlighter.SetRange(FTheLinesView.Ranges[PosY - 1]);
|
||||||
fHighlighter.SetLine(Line, PosY - 1);
|
fHighlighter.SetLine(Line, PosY - 1);
|
||||||
TokenListCnt := 0;
|
TokenListCnt := 0;
|
||||||
end
|
end
|
||||||
@ -8834,11 +8828,7 @@ begin
|
|||||||
if Assigned(Highlighter) and (PosY >= 0) and (PosY < FTheLinesView.Count) then
|
if Assigned(Highlighter) and (PosY >= 0) and (PosY < FTheLinesView.Count) then
|
||||||
begin
|
begin
|
||||||
Line := FTheLinesView[PosY];
|
Line := FTheLinesView[PosY];
|
||||||
{$IFDEF SYN_LAZARUS}
|
Highlighter.SetRange(FTheLinesView.Ranges[PosY]);
|
||||||
Highlighter.SetRange(TSynEditStrings(FTheLinesView).Ranges[PosY]);
|
|
||||||
{$ELSE}
|
|
||||||
Highlighter.SetRange(TSynEditStringList(Lines).Ranges[PosY]);
|
|
||||||
{$ENDIF}
|
|
||||||
Highlighter.SetLine(Line, PosY);
|
Highlighter.SetLine(Line, PosY);
|
||||||
PosX := XY.X;
|
PosX := XY.X;
|
||||||
if (PosX > 0) and (PosX <= Length(Line)) then begin
|
if (PosX > 0) and (PosX <= Length(Line)) then begin
|
||||||
@ -9080,7 +9070,7 @@ end;
|
|||||||
|
|
||||||
function TCustomSynEdit.LogicalToPhysicalPos(const p: TPoint): TPoint;
|
function TCustomSynEdit.LogicalToPhysicalPos(const p: TPoint): TPoint;
|
||||||
begin
|
begin
|
||||||
Result := TSynEditStrings(FTheLinesView).LogicalToPhysicalPos(p);
|
Result := FTheLinesView.LogicalToPhysicalPos(p);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomSynEdit.LogicalToPhysicalCol(const Line: String;
|
function TCustomSynEdit.LogicalToPhysicalCol(const Line: String;
|
||||||
@ -9088,7 +9078,7 @@ function TCustomSynEdit.LogicalToPhysicalCol(const Line: String;
|
|||||||
// LogicalPos is 1-based
|
// LogicalPos is 1-based
|
||||||
// Index 0-based LineNumber
|
// Index 0-based LineNumber
|
||||||
begin
|
begin
|
||||||
Result := TSynEditStrings(FTheLinesView).LogicalToPhysicalCol(Line, Index,
|
Result := FTheLinesView.LogicalToPhysicalCol(Line, Index,
|
||||||
LogicalPos);
|
LogicalPos);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -9099,13 +9089,13 @@ end;
|
|||||||
|
|
||||||
function TCustomSynEdit.PhysicalToLogicalPos(const p: TPoint): TPoint;
|
function TCustomSynEdit.PhysicalToLogicalPos(const p: TPoint): TPoint;
|
||||||
begin
|
begin
|
||||||
Result := TSynEditStrings(FTheLinesView).PhysicalToLogicalPos(p);
|
Result := FTheLinesView.PhysicalToLogicalPos(p);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomSynEdit.PhysicalToLogicalCol(const Line: string;
|
function TCustomSynEdit.PhysicalToLogicalCol(const Line: string;
|
||||||
Index, PhysicalPos: integer): integer;
|
Index, PhysicalPos: integer): integer;
|
||||||
begin
|
begin
|
||||||
Result := TSynEditStrings(FTheLinesView).PhysicalToLogicalCol(Line, Index,
|
Result := FTheLinesView.PhysicalToLogicalCol(Line, Index,
|
||||||
PhysicalPos);
|
PhysicalPos);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,8 @@ uses
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
Windows,
|
Windows,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Classes, Graphics, Controls, SysUtils, SynEditMiscProcs, SynEditTypes;
|
Classes, Graphics, Controls, SysUtils, SynEditMiscProcs, SynEditTypes,
|
||||||
|
SynEditTextBase;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -55,13 +56,14 @@ type
|
|||||||
// in places where TCustomSynEdit can not be used due to circular unit refs
|
// in places where TCustomSynEdit can not be used due to circular unit refs
|
||||||
TSynEditBase = class(TCustomControl)
|
TSynEditBase = class(TCustomControl)
|
||||||
protected
|
protected
|
||||||
function GetTheLinesView: TStrings; virtual; abstract;
|
|
||||||
procedure SetRealLines(const AValue : TStrings); virtual; abstract;
|
|
||||||
function GetLines: TStrings; virtual; abstract;
|
function GetLines: TStrings; virtual; abstract;
|
||||||
procedure SetLines(Value: TStrings); virtual; abstract;
|
procedure SetLines(Value: TStrings); virtual; abstract;
|
||||||
|
function GetViewedTextBuffer: TSynEditStrings; virtual; abstract;
|
||||||
|
function GetTextBuffer: TSynEditStrings; virtual; abstract;
|
||||||
|
property ViewedTextBuffer: TSynEditStrings read GetViewedTextBuffer; // As viewed internally (with uncommited spaces / TODO: expanded tabs, folds). This may change, use with care
|
||||||
|
property TextBuffer: TSynEditStrings read GetTextBuffer; // No uncommited (trailing/trimmable) spaces
|
||||||
public
|
public
|
||||||
property RealLines: TStrings read GetTheLinesView write SetRealLines; // As viewed internally (with uncommited spaces / TODO: expanded tabs, folds). This may change, use with care
|
property Lines: TStrings read GetLines write SetLines;
|
||||||
property Lines: TStrings read GetLines write SetLines; // No uncommited (trailing/trimmable) spaces
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TSynObjectListItem = class;
|
TSynObjectListItem = class;
|
||||||
|
|||||||
@ -610,7 +610,7 @@ var
|
|||||||
TempString := Copy(FLines[BB.Y - 1], 1, BB.X - 1) +
|
TempString := Copy(FLines[BB.Y - 1], 1, BB.X - 1) +
|
||||||
Copy(FLines[BE.Y - 1], BE.X, MaxInt);
|
Copy(FLines[BE.Y - 1], BE.X, MaxInt);
|
||||||
// Delete all FLines in the selection range.
|
// Delete all FLines in the selection range.
|
||||||
TSynEditStrings(FLines).DeleteLines(BB.Y-1, BE.Y - BB.Y);
|
FLines.DeleteLines(BB.Y-1, BE.Y - BB.Y);
|
||||||
FLines[BB.Y - 1] := TempString;
|
FLines[BB.Y - 1] := TempString;
|
||||||
end;
|
end;
|
||||||
UpdateMarks := TRUE;
|
UpdateMarks := TRUE;
|
||||||
@ -713,7 +713,7 @@ var
|
|||||||
P := GetEOL(Start);
|
P := GetEOL(Start);
|
||||||
if P^ <> #0 then begin
|
if P^ <> #0 then begin
|
||||||
SetString(Str, Value, P - Start);
|
SetString(Str, Value, P - Start);
|
||||||
TSynEditStrings(FLines).InsertLines(FCaret.LinePos - 1, CountLines(P));
|
FLines.InsertLines(FCaret.LinePos - 1, CountLines(P));
|
||||||
FLines[FCaret.LinePos - 1] := sLeftSide + Str;
|
FLines[FCaret.LinePos - 1] := sLeftSide + Str;
|
||||||
end else begin
|
end else begin
|
||||||
FLines[FCaret.LinePos - 1] := sLeftSide + Value + sRightSide;
|
FLines[FCaret.LinePos - 1] := sLeftSide + Value + sRightSide;
|
||||||
|
|||||||
@ -121,7 +121,6 @@ type
|
|||||||
procedure Insert(Index: integer; const S: string); override;
|
procedure Insert(Index: integer; const S: string); override;
|
||||||
procedure InsertLines(Index, NumLines: integer); override;
|
procedure InsertLines(Index, NumLines: integer); override;
|
||||||
procedure InsertStrings(Index: integer; NewStrings: TStrings); override;
|
procedure InsertStrings(Index: integer; NewStrings: TStrings); override;
|
||||||
procedure Exchange(Index1, Index2: integer); override;
|
|
||||||
|
|
||||||
procedure ClearRanges(ARange: TSynEditRange); override;
|
procedure ClearRanges(ARange: TSynEditRange); override;
|
||||||
|
|
||||||
@ -303,11 +302,6 @@ begin
|
|||||||
fSynStrings.InsertStrings(Index, NewStrings);
|
fSynStrings.InsertStrings(Index, NewStrings);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringsLinked.Exchange(Index1, Index2: integer);
|
|
||||||
begin
|
|
||||||
fSynStrings.Exchange(Index1, Index2);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSynEditStringsLinked.GetIsUtf8: Boolean;
|
function TSynEditStringsLinked.GetIsUtf8: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := FSynStrings.IsUtf8;
|
Result := FSynStrings.IsUtf8;
|
||||||
|
|||||||
@ -183,14 +183,11 @@ type
|
|||||||
procedure RegisterAttribute(const Index: TClass; const Size: Word); override;
|
procedure RegisterAttribute(const Index: TClass; const Size: Word); override;
|
||||||
procedure DeleteLines(Index, NumLines: integer); // DJLP 2000-11-01
|
procedure DeleteLines(Index, NumLines: integer); // DJLP 2000-11-01
|
||||||
{$IFDEF SYN_LAZARUS}override;{$ENDIF}
|
{$IFDEF SYN_LAZARUS}override;{$ENDIF}
|
||||||
procedure Exchange(Index1, Index2: integer); override;
|
|
||||||
procedure Insert(Index: integer; const S: string); override;
|
procedure Insert(Index: integer; const S: string); override;
|
||||||
procedure InsertLines(Index, NumLines: integer); // DJLP 2000-11-01
|
procedure InsertLines(Index, NumLines: integer); // DJLP 2000-11-01
|
||||||
{$IFDEF SYN_LAZARUS}override;{$ENDIF}
|
{$IFDEF SYN_LAZARUS}override;{$ENDIF}
|
||||||
procedure InsertStrings(Index: integer; NewStrings: TStrings); // DJLP 2000-11-01
|
procedure InsertStrings(Index: integer; NewStrings: TStrings); // DJLP 2000-11-01
|
||||||
{$IFDEF SYN_LAZARUS}override;{$ENDIF}
|
{$IFDEF SYN_LAZARUS}override;{$ENDIF}
|
||||||
procedure LoadFromFile(const FileName: string); override;
|
|
||||||
procedure SaveToFile(const FileName: string); override;
|
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
procedure ClearRanges(ARange: TSynEditRange); override;
|
procedure ClearRanges(ARange: TSynEditRange); override;
|
||||||
procedure MarkModified(AFirst, ALast: Integer; AUndo: Boolean; AReason: TSynChangeReason);
|
procedure MarkModified(AFirst, ALast: Integer; AUndo: Boolean; AReason: TSynChangeReason);
|
||||||
@ -297,206 +294,6 @@ const
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
SListIndexOutOfBounds = 'Invalid stringlist index %d';
|
SListIndexOutOfBounds = 'Invalid stringlist index %d';
|
||||||
|
|
||||||
{ TSynEditFiler }
|
|
||||||
|
|
||||||
type
|
|
||||||
TSynEditFiler = class(TObject)
|
|
||||||
protected
|
|
||||||
fBuffer: PChar;
|
|
||||||
fBufPtr: Cardinal;
|
|
||||||
fBufSize: Cardinal;
|
|
||||||
fDosFile: boolean;
|
|
||||||
fFiler: TFileStream;
|
|
||||||
procedure Flush; virtual;
|
|
||||||
procedure SetBufferSize(NewSize: Cardinal);
|
|
||||||
public
|
|
||||||
constructor Create;
|
|
||||||
destructor Destroy; override;
|
|
||||||
public
|
|
||||||
property DosFile: boolean read fDosFile write fDosFile;
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TSynEditFiler.Create;
|
|
||||||
const
|
|
||||||
kByte = 1024;
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
fDosFile := FALSE;
|
|
||||||
SetBufferSize(16 * kByte);
|
|
||||||
fBuffer[0] := #0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TSynEditFiler.Destroy;
|
|
||||||
begin
|
|
||||||
Flush;
|
|
||||||
fFiler.Free;
|
|
||||||
SetBufferSize(0);
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditFiler.Flush;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditFiler.SetBufferSize(NewSize: Cardinal);
|
|
||||||
begin
|
|
||||||
if NewSize <> fBufSize then begin
|
|
||||||
ReallocMem(fBuffer, NewSize);
|
|
||||||
fBufSize := NewSize;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TSynEditFileReader }
|
|
||||||
|
|
||||||
type
|
|
||||||
TSynEditFileReader = class(TSynEditFiler)
|
|
||||||
protected
|
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
fFilePos: TStreamSeekType;
|
|
||||||
fFileSize: TStreamSeekType;
|
|
||||||
{$ELSE}
|
|
||||||
fFilePos: Cardinal;
|
|
||||||
fFileSize: Cardinal;
|
|
||||||
{$ENDIF}
|
|
||||||
procedure FillBuffer;
|
|
||||||
public
|
|
||||||
constructor Create(const FileName: string);
|
|
||||||
function EOF: boolean;
|
|
||||||
function ReadLine: string;
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TSynEditFileReader.Create(const FileName: string);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
fFiler := TFileStream.Create(UTF8ToSys(FileName), fmOpenRead{ ToDo: or fmShareDenyWrite});
|
|
||||||
fFileSize := fFiler.Size;
|
|
||||||
fFiler.Seek(0, soFromBeginning);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSynEditFileReader.EOF: boolean;
|
|
||||||
begin
|
|
||||||
Result := (fBuffer[fBufPtr] = #0) and (fFilePos >= fFileSize);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditFileReader.FillBuffer;
|
|
||||||
var
|
|
||||||
Count: Cardinal;
|
|
||||||
begin
|
|
||||||
if fBufPtr >= fBufSize - 1 then
|
|
||||||
fBufPtr := 0;
|
|
||||||
Count := fFileSize - fFilePos;
|
|
||||||
if Count >= fBufSize - fBufPtr then
|
|
||||||
Count := fBufSize - fBufPtr - 1;
|
|
||||||
fFiler.ReadBuffer(fBuffer[fBufPtr], Count);
|
|
||||||
fBuffer[fBufPtr + Count] := #0;
|
|
||||||
fFilePos := fFilePos + Count;
|
|
||||||
fBufPtr := 0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSynEditFileReader.ReadLine: string;
|
|
||||||
var
|
|
||||||
E, P, S: PChar;
|
|
||||||
begin
|
|
||||||
Result := '';
|
|
||||||
repeat
|
|
||||||
S := PChar(@fBuffer[fBufPtr]);
|
|
||||||
if S[0] = #0 then begin
|
|
||||||
FillBuffer;
|
|
||||||
S := PChar(@fBuffer[0]);
|
|
||||||
end;
|
|
||||||
E := PChar(@fBuffer[fBufSize]);
|
|
||||||
P := S;
|
|
||||||
while P + 2 < E do begin
|
|
||||||
case P[0] of
|
|
||||||
#10, #13:
|
|
||||||
begin
|
|
||||||
SetString(Result, S, P - S);
|
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
// a single #13 is used in Mac OS files
|
|
||||||
if (P[0] = #13) and (P[1] = #10) then begin
|
|
||||||
{$ELSE}
|
|
||||||
if P[0] = #13 then begin
|
|
||||||
{$ENDIF}
|
|
||||||
fDosFile := TRUE;
|
|
||||||
Inc(P);
|
|
||||||
end;
|
|
||||||
Inc(P);
|
|
||||||
fBufPtr := P - fBuffer;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
#0:
|
|
||||||
if fFilePos >= fFileSize then begin
|
|
||||||
fBufPtr := P - fBuffer;
|
|
||||||
SetString(Result, S, P - S);
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
Inc(P);
|
|
||||||
end;
|
|
||||||
// put the partial string to the start of the buffer, and refill the buffer
|
|
||||||
Inc(P);
|
|
||||||
if S > fBuffer then
|
|
||||||
StrLCopy(fBuffer, S, P - S);
|
|
||||||
fBufPtr := P - S;
|
|
||||||
fBuffer[fBufPtr] := #0;
|
|
||||||
// if line is longer than half the buffer then grow it first
|
|
||||||
if 2 * Cardinal(P - S) > fBufSize then
|
|
||||||
SetBufferSize(fBufSize + fBufSize);
|
|
||||||
until FALSE;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TSynEditFileWriter }
|
|
||||||
|
|
||||||
type
|
|
||||||
TSynEditFileWriter = class(TSynEditFiler)
|
|
||||||
protected
|
|
||||||
procedure Flush; override;
|
|
||||||
public
|
|
||||||
constructor Create(const FileName: string);
|
|
||||||
procedure WriteLine(const S: string);
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TSynEditFileWriter.Create(const FileName: string);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
fFiler := TFileStream.Create(UTF8ToSys(FileName), fmCreate);
|
|
||||||
fFiler.Seek(0, soFromBeginning);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditFileWriter.Flush;
|
|
||||||
begin
|
|
||||||
if fBufPtr > 0 then begin
|
|
||||||
fFiler.WriteBuffer(fBuffer[0], fBufPtr);
|
|
||||||
fBufPtr := 0;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditFileWriter.WriteLine(const S: string);
|
|
||||||
var
|
|
||||||
L, NL: Cardinal;
|
|
||||||
begin
|
|
||||||
L := Length(S);
|
|
||||||
NL := 1 + Ord(fDosFile);
|
|
||||||
repeat
|
|
||||||
if fBufPtr + L + NL <= fBufSize then begin
|
|
||||||
if L > 0 then begin
|
|
||||||
Move(S[1], fBuffer[fBufPtr], L);
|
|
||||||
fBufPtr := fBufPtr + L;
|
|
||||||
end;
|
|
||||||
if fDosFile then begin
|
|
||||||
fBuffer[fBufPtr] := #13;
|
|
||||||
Inc(fBufPtr);
|
|
||||||
end;
|
|
||||||
fBuffer[fBufPtr] := #10;
|
|
||||||
Inc(fBufPtr);
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
Flush;
|
|
||||||
if L + NL > fBufSize then
|
|
||||||
SetBufferSize(L + NL);
|
|
||||||
until FALSE;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TSynEditStringList }
|
{ TSynEditStringList }
|
||||||
|
|
||||||
procedure ListIndexOutOfBounds(Index: integer);
|
procedure ListIndexOutOfBounds(Index: integer);
|
||||||
@ -626,25 +423,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
{end} // DJLP 2000-11-01
|
{end} // DJLP 2000-11-01
|
||||||
|
|
||||||
procedure TSynEditStringList.Exchange(Index1, Index2: integer);
|
|
||||||
begin
|
|
||||||
if (Index1 < 0) or (Index1 >= Count) then
|
|
||||||
ListIndexOutOfBounds(Index1);
|
|
||||||
if (Index2 < 0) or (Index2 >= Count) then
|
|
||||||
ListIndexOutOfBounds(Index2);
|
|
||||||
BeginUpdate;
|
|
||||||
If Count+1 >= Capacity then Grow;
|
|
||||||
FList.Move(Index1, Count, 1);
|
|
||||||
FList.Move(Index2, Index1, 1);
|
|
||||||
FList.Move(Count, Index2, 1);
|
|
||||||
FList.Move(Count+1, Count, 1); // clean it
|
|
||||||
if fIndexOfLongestLine = Index1 then
|
|
||||||
fIndexOfLongestLine := Index2
|
|
||||||
else if fIndexOfLongestLine = Index2 then
|
|
||||||
fIndexOfLongestLine := Index1;
|
|
||||||
EndUpdate;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
function TSynEditStringList.GetFlags(Index: Integer): TSynEditStringFlags;
|
function TSynEditStringList.GetFlags(Index: Integer): TSynEditStringFlags;
|
||||||
begin
|
begin
|
||||||
@ -830,26 +608,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
{end} // DJLP 2000-11-01
|
{end} // DJLP 2000-11-01
|
||||||
|
|
||||||
procedure TSynEditStringList.LoadFromFile(const FileName: string);
|
|
||||||
var
|
|
||||||
Reader: TSynEditFileReader;
|
|
||||||
begin
|
|
||||||
Reader := TSynEditFileReader.Create(FileName);
|
|
||||||
try
|
|
||||||
BeginUpdate;
|
|
||||||
try
|
|
||||||
Clear;
|
|
||||||
while not Reader.EOF do
|
|
||||||
Add(Reader.ReadLine);
|
|
||||||
fDosFileFormat := Reader.DosFile;
|
|
||||||
finally
|
|
||||||
EndUpdate;
|
|
||||||
end;
|
|
||||||
finally
|
|
||||||
Reader.Free;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditStringList.Put(Index: integer; const S: string);
|
procedure TSynEditStringList.Put(Index: integer; const S: string);
|
||||||
begin
|
begin
|
||||||
if (Index = 0) and (Count = 0) then
|
if (Index = 0) and (Count = 0) then
|
||||||
@ -956,23 +714,6 @@ begin
|
|||||||
SetAttribute(TSynEditFlagsClass, Index, Pointer(PtrUInt(Integer(AValue))));
|
SetAttribute(TSynEditFlagsClass, Index, Pointer(PtrUInt(Integer(AValue))));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringList.SaveToFile(const FileName: string);
|
|
||||||
var
|
|
||||||
Writer: TSynEditFileWriter;
|
|
||||||
i: integer;
|
|
||||||
begin
|
|
||||||
Writer := TSynEditFileWriter.Create(FileName);
|
|
||||||
try
|
|
||||||
Writer.DosFile := fDosFileFormat;
|
|
||||||
for i := 0 to Count - 1 do
|
|
||||||
Writer.WriteLine(Get(i));
|
|
||||||
finally
|
|
||||||
Writer.Free;
|
|
||||||
end;
|
|
||||||
MarkSaved;
|
|
||||||
FLineRangeNotificationList.CallRangeNotifyEvents(self, 0, 0);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
procedure TSynEditStringList.ClearRanges(ARange: TSynEditRange);
|
procedure TSynEditStringList.ClearRanges(ARange: TSynEditRange);
|
||||||
var
|
var
|
||||||
|
|||||||
@ -214,7 +214,7 @@ var
|
|||||||
allmrk: TSynEditMarks;
|
allmrk: TSynEditMarks;
|
||||||
begin
|
begin
|
||||||
line := TSynEdit(FEdit).PixelsToRowColumn(Point(X, Y)).Y;
|
line := TSynEdit(FEdit).PixelsToRowColumn(Point(X, Y)).Y;
|
||||||
if line <= TSynEdit(FEdit).Lines.Count then begin
|
if line <= FEdit.Lines.Count then begin
|
||||||
mark := nil;
|
mark := nil;
|
||||||
TSynEdit(FEdit).Marks.GetMarksForLine(line, allmrk);
|
TSynEdit(FEdit).Marks.GetMarksForLine(line, allmrk);
|
||||||
offs := 0;
|
offs := 0;
|
||||||
|
|||||||
@ -72,7 +72,7 @@ var
|
|||||||
line : integer;
|
line : integer;
|
||||||
begin
|
begin
|
||||||
line := TSynEdit(SynEdit).PixelsToRowColumn(Point(X, Y)).Y;
|
line := TSynEdit(SynEdit).PixelsToRowColumn(Point(X, Y)).Y;
|
||||||
if line <= TSynEdit(SynEdit).Lines.Count then
|
if line <= SynEdit.Lines.Count then
|
||||||
TSynEdit(SynEdit).CodeFoldAction(line);
|
TSynEdit(SynEdit).CodeFoldAction(line);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -240,7 +240,7 @@ begin
|
|||||||
// or a multiple of ShowOnlyLineNumbersMultiplesOf
|
// or a multiple of ShowOnlyLineNumbersMultiplesOf
|
||||||
ShowDot := ((iLine mod ShowOnlyLineNumbersMultiplesOf) <> 0)
|
ShowDot := ((iLine mod ShowOnlyLineNumbersMultiplesOf) <> 0)
|
||||||
and (iLine <> TSynEdit(SynEdit).CaretY) and (iLine <> 1)
|
and (iLine <> TSynEdit(SynEdit).CaretY) and (iLine <> 1)
|
||||||
and (iLine <> TSynEdit(SynEdit).Lines.Count);
|
and (iLine <> SynEdit.Lines.Count);
|
||||||
// Get the formatted line number or dot
|
// Get the formatted line number or dot
|
||||||
s := FormatLineNumber(iLine, ShowDot);
|
s := FormatLineNumber(iLine, ShowDot);
|
||||||
Inc(rcLine.Bottom, LineHeight);
|
Inc(rcLine.Bottom, LineHeight);
|
||||||
|
|||||||
@ -82,7 +82,7 @@ var
|
|||||||
begin
|
begin
|
||||||
iTop := 0;
|
iTop := 0;
|
||||||
CurMark := TSynEdit(SynEdit).Marks[iMark];
|
CurMark := TSynEdit(SynEdit).Marks[iMark];
|
||||||
if (CurMark.Line<1) or (CurMark.Line>TSynEdit(SynEdit).Lines.Count) then exit;
|
if (CurMark.Line<1) or (CurMark.Line > SynEdit.Lines.Count) then exit;
|
||||||
if FFoldView.FoldedAtTextIndex[CurMark.Line-1] then exit;
|
if FFoldView.FoldedAtTextIndex[CurMark.Line-1] then exit;
|
||||||
iLine := FFoldView.TextIndexToScreenLine(CurMark.Line-1);
|
iLine := FFoldView.TextIndexToScreenLine(CurMark.Line-1);
|
||||||
|
|
||||||
|
|||||||
@ -204,8 +204,8 @@ begin
|
|||||||
e:=LineEnding;
|
e:=LineEnding;
|
||||||
LineEndLen:=length(e);
|
LineEndLen:=length(e);
|
||||||
Chars := 0;
|
Chars := 0;
|
||||||
while y < Lines.Count do begin
|
while y < TextBuffer.Count do begin
|
||||||
x := Length(Lines[y]);
|
x := Length(TextBuffer[y]);
|
||||||
if Chars + x + LineEndLen > Index then begin
|
if Chars + x + LineEndLen > Index then begin
|
||||||
x := Index - Chars;
|
x := Index - Chars;
|
||||||
break;
|
break;
|
||||||
@ -224,11 +224,11 @@ var
|
|||||||
LineEndLen: Integer;
|
LineEndLen: Integer;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
RowCol.y := Min(Lines.Count, RowCol.y) - 1;
|
RowCol.y := Min(TextBuffer.Count, RowCol.y) - 1;
|
||||||
e:=LineEnding;
|
e:=LineEnding;
|
||||||
LineEndLen:=length(e);
|
LineEndLen:=length(e);
|
||||||
for i := 0 to RowCol.y - 1 do
|
for i := 0 to RowCol.y - 1 do
|
||||||
Result := Result + Length(Lines[i]) + LineEndLen;
|
Result := Result + Length(TextBuffer[i]) + LineEndLen;
|
||||||
Result := Result + RowCol.x;
|
Result := Result + RowCol.x;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user