|
@@ -72,6 +72,7 @@ type
|
|
TCodeEditorCore = object(TCustomCodeEditorCore)
|
|
TCodeEditorCore = object(TCustomCodeEditorCore)
|
|
protected
|
|
protected
|
|
Lines : PLineCollection;
|
|
Lines : PLineCollection;
|
|
|
|
+ MaxDispLen : Cardinal;
|
|
CanUndo : Boolean;
|
|
CanUndo : Boolean;
|
|
StoreUndo : boolean;
|
|
StoreUndo : boolean;
|
|
Modified : Boolean;
|
|
Modified : Boolean;
|
|
@@ -107,6 +108,7 @@ type
|
|
procedure ISetLineFormat(Binding: PEditorBinding; LineNo: sw_integer;const S: sw_astring); virtual;
|
|
procedure ISetLineFormat(Binding: PEditorBinding; LineNo: sw_integer;const S: sw_astring); virtual;
|
|
public
|
|
public
|
|
{ Text & info storage abstraction }
|
|
{ Text & info storage abstraction }
|
|
|
|
+ function GetMaxDisplayLength: sw_integer; virtual;
|
|
function GetLineCount: sw_integer; virtual;
|
|
function GetLineCount: sw_integer; virtual;
|
|
function GetLine(LineNo: sw_integer): PCustomLine; virtual;
|
|
function GetLine(LineNo: sw_integer): PCustomLine; virtual;
|
|
function GetLineText(LineNo: sw_integer): sw_AString; virtual;
|
|
function GetLineText(LineNo: sw_integer): sw_AString; virtual;
|
|
@@ -180,6 +182,7 @@ type
|
|
public
|
|
public
|
|
{ ChangedLine : sw_integer;}
|
|
{ ChangedLine : sw_integer;}
|
|
{ Text & info storage abstraction }
|
|
{ Text & info storage abstraction }
|
|
|
|
+ function GetMaxDisplayLength: sw_integer; virtual;
|
|
function GetLineCount: sw_integer; virtual;
|
|
function GetLineCount: sw_integer; virtual;
|
|
function GetLine(LineNo: sw_integer): PCustomLine; virtual;
|
|
function GetLine(LineNo: sw_integer): PCustomLine; virtual;
|
|
function CharIdxToLinePos(Line,CharIdx: sw_integer): sw_integer; virtual;
|
|
function CharIdxToLinePos(Line,CharIdx: sw_integer): sw_integer; virtual;
|
|
@@ -393,6 +396,7 @@ begin
|
|
new(UndoList,init(500,1000));
|
|
new(UndoList,init(500,1000));
|
|
new(RedoList,init(500,1000));
|
|
new(RedoList,init(500,1000));
|
|
New(Lines, Init(500,1000));
|
|
New(Lines, Init(500,1000));
|
|
|
|
+ MaxDispLen:=0;
|
|
TabSize:=DefaultTabSize;
|
|
TabSize:=DefaultTabSize;
|
|
IndentSize:=DefaultIndentSize;
|
|
IndentSize:=DefaultIndentSize;
|
|
OnDiskLoadTime:=0;
|
|
OnDiskLoadTime:=0;
|
|
@@ -406,6 +410,11 @@ begin
|
|
Lines:=ALines;
|
|
Lines:=ALines;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TCodeEditorCore.GetMaxDisplayLength: sw_integer;
|
|
|
|
+begin
|
|
|
|
+ GetMaxDisplayLength:=MaxDispLen;
|
|
|
|
+end;
|
|
|
|
+
|
|
function TCodeEditorCore.GetLineCount: sw_integer;
|
|
function TCodeEditorCore.GetLineCount: sw_integer;
|
|
begin
|
|
begin
|
|
GetLineCount:=Lines^.Count;
|
|
GetLineCount:=Lines^.Count;
|
|
@@ -570,6 +579,7 @@ procedure TCodeEditorCore.SetLineText(I: sw_integer;const S: sw_AString);
|
|
var
|
|
var
|
|
L : PCustomLine;
|
|
L : PCustomLine;
|
|
AddCount : Sw_Integer;
|
|
AddCount : Sw_Integer;
|
|
|
|
+ DS : sw_AString;
|
|
begin
|
|
begin
|
|
AddCount:=0;
|
|
AddCount:=0;
|
|
while (Lines^.Count<I+1) do
|
|
while (Lines^.Count<I+1) do
|
|
@@ -577,10 +587,16 @@ begin
|
|
LinesInsert(-1,New(PLine, Init(@Self,'',0)));
|
|
LinesInsert(-1,New(PLine, Init(@Self,'',0)));
|
|
Inc(AddCount);
|
|
Inc(AddCount);
|
|
end;
|
|
end;
|
|
- if AddCount>0 then
|
|
|
|
- LimitsChanged;
|
|
|
|
L:=Lines^.At(I);
|
|
L:=Lines^.At(I);
|
|
L^.SetText(S);
|
|
L^.SetText(S);
|
|
|
|
+ DS:=GetDisplayText(I);
|
|
|
|
+ if MaxDispLen<Length(DS) then
|
|
|
|
+ begin
|
|
|
|
+ MaxDispLen:=Length(DS);
|
|
|
|
+ inc(AddCount); { indicate to call LimitChanged }
|
|
|
|
+ end;
|
|
|
|
+ if AddCount>0 then
|
|
|
|
+ LimitsChanged;
|
|
ContentsChanged;
|
|
ContentsChanged;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1003,6 +1019,11 @@ begin
|
|
DrawView;
|
|
DrawView;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TCodeEditor.GetMaxDisplayLength: sw_integer;
|
|
|
|
+begin
|
|
|
|
+ GetMaxDisplayLength:=Core^.GetMaxDisplayLength;
|
|
|
|
+end;
|
|
|
|
+
|
|
function TCodeEditor.GetLineCount: sw_integer;
|
|
function TCodeEditor.GetLineCount: sw_integer;
|
|
begin
|
|
begin
|
|
GetLineCount:=Core^.GetLineCount;
|
|
GetLineCount:=Core^.GetLineCount;
|