更新
This commit is contained in:
JianjunLiu 2023-07-28 15:16:45 +08:00
parent 5324cd4e1e
commit f792da4703
4 changed files with 42 additions and 32 deletions

Binary file not shown.

View File

@ -2923,6 +2923,8 @@ type TSynCompletion = class(TSynCompletionList)
begin begin
if M<>FMemo then if M<>FMemo then
begin begin
tm := FMemo;
if tm then tm.Completion := nil;
FMemo := M; FMemo := M;
IF M IS CLASS(TSynCustomMemo) then IF M IS CLASS(TSynCustomMemo) then
begin begin
@ -3079,6 +3081,7 @@ type TSynHighLighter = class(TComponent) //
if Memo<>M then if Memo<>M then
begin begin
tfm := FMemo; tfm := FMemo;
if tfm then tfm.Highlighter := nil;
FMemo := M; FMemo := M;
if M is Class(TSynCustomMemo) then if M is Class(TSynCustomMemo) then
begin begin
@ -3089,7 +3092,7 @@ type TSynHighLighter = class(TComponent) //
FMemo := nil; FMemo := nil;
Flines := nil; Flines := nil;
end end
if tfm is Class(TSynCustomMemo) then tfm.Highlighter := nil; //if tfm is Class(TSynCustomMemo) then tfm.Highlighter := nil;
SetInValidateIndex(1); SetInValidateIndex(1);
end end
end end

View File

@ -1130,7 +1130,7 @@ type tnumindexarrayex = class(tnumindexarray)
end end
//ifdef newgetop //ifdef newgetop
type trefarray = class() //数组成员引用模拟 type trefarray = class() //数组成员引用模拟
function create(d,bidxs); //¹¹Ô캯Êý function create(d); //¹¹Ô캯Êý
begin begin
if ifarray(d) or (d is class(trefarray)) then if ifarray(d) or (d is class(trefarray)) then
begin begin
@ -1139,22 +1139,15 @@ type trefarray = class() //
begin begin
FData := array(); FData := array();
end end
if ifarray(bidxs) then
begin
FBindexs := bidxs;
end else
begin
FBindexs := array();
end
end end
function mgset(idxs,v); //根据下标设置值 function mgset(idxs,v); //根据下标设置值
begin begin
if not ifarray(idxs) then return nil; if not ifarray(idxs) then return nil;
if ifarray(FData) then if ifarray(FData) then
begin begin
return magicsetarray(FData,FBindexs union idxs,v); return magicsetarray(FData, idxs,v);
end end
return FData.mgset(FBindexs union idxs,v); return FData.mgset(idxs,v);
end end
function mgget(idxs); //根据获得值 function mgget(idxs); //根据获得值
begin begin
@ -1163,7 +1156,7 @@ type trefarray = class() //
begin begin
return magicgetarray(FData,idxs); return magicgetarray(FData,idxs);
end end
return FData.mgget(FBindexs union idxs,v); return FData.mgget(idxs,v);
end end
function operator[0](idx,v); //获取值 function operator[0](idx,v); //获取值
begin begin
@ -1181,9 +1174,18 @@ type trefarray = class() //
end end
return mgset(array(idx),v); //一级直接返回 return mgset(array(idx),v); //一级直接返回
end end
published
property data read FData write setdata;
private //成员变量 private //成员变量
FData; FData;
FBindexs; private
function setdata(d);
begin
if FData<>d and ifarray(d) then
begin
FData := d;
end
end
private //中间对象 private //中间对象
type trefsgter = class() type trefsgter = class()
function create(a,idx); function create(a,idx);
@ -1737,13 +1739,11 @@ type TTire = class()
@explan(说明) tire树 @explan(说明) tire树
**} **}
type TTireNode = class() type TTireNode = class()
[weakref] parent;
FChar; FChar;
FSub; FSub;
FEnd; FEnd;
Ficase; Ficase;
_tag; _tag;
_tag2;
function Create(v); function Create(v);
begin begin
FChar := v; FChar := v;
@ -1761,7 +1761,6 @@ type TTire = class()
vsub := new TTireNode(v0); vsub := new TTireNode(v0);
vsub.Ficase := Ficase; vsub.Ficase := Ficase;
FSub[v0] := vsub; FSub[v0] := vsub;
vsub.Parent := self;
end end
ls := length(s); ls := length(s);
if ls>1 then if ls>1 then
@ -2308,9 +2307,14 @@ type tstr_step_match=class()
{** {**
@explan(说明)字符串数组匹配 %% @explan(说明)字符串数组匹配 %%
**} **}
private
const find_end="end";
public
function create(its); //送入匹配的字符串数组 function create(its); //送入匹配的字符串数组
begin begin
fits := array(); fits := array();
fcaches := array();
fcaches[""] := array();
set_items(its); set_items(its);
end end
function step_find_idx(s:string); //匹配的序号 function step_find_idx(s:string); //匹配的序号
@ -2320,19 +2324,21 @@ type tstr_step_match=class()
@param(s)(string) 匹配的目标 %% @param(s)(string) 匹配的目标 %%
@return(array of integer) 成功的位置 %% @return(array of integer) 成功的位置 %%
**} **}
if not ftree then return array(); if fcaches[s] then return fcaches[s]; //ÍêÈ«
o := ftree.find_node(s,idx); osi := fcaches[""];
if o and ((idx-1)=length(s)) then return o._tag; for i:= 1 to length(s) do
if not o then o := ftree.FRoot;
for i := idx to length(s) do
begin begin
si := s[1:i]; si := s[1:i];
oi := ftree.add(si); if fcaches[si] then
asi := get_same_idexs(si,o._tag); begin
oi._tag := asi; osi := fcaches[si];
o := oi; continue;
end end
return o._tag; osi := get_same_idexs(si,osi);
if not ifarray(osi) then osi := array();
fcaches[si] := osi;
end
return fcaches[s];
end end
function step_find(s); //查找匹配的字符 function step_find(s); //查找匹配的字符
begin begin
@ -2343,8 +2349,8 @@ type tstr_step_match=class()
if fits<> its and check_legal(its) then if fits<> its and check_legal(its) then
begin begin
fits := its; fits := its;
ftree := new TTire(); fcaches := array();
ftree.FRoot._tag := mrows(fits,1); fcaches[""] := mrows(fits,1);
end end
end end
private private
@ -2371,7 +2377,8 @@ type tstr_step_match=class()
end end
protected protected
fits; //原始数据 fits; //原始数据
ftree; fcaches;
fcacheslen;
private private
end end
implementation implementation

Binary file not shown.